Skip to content

Commit

Permalink
Merge branch 'master' into 3795-warnings-in-baseteamfragment
Browse files Browse the repository at this point in the history
  • Loading branch information
dogi authored Jul 9, 2024
2 parents 8b5fc4b + 091cc83 commit c02b602
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ open class RealmUserModel : RealmObject() {
@JvmField
var birthPlace: String? = null
@JvmField
var communityName: String? = null
@JvmField
var userImage: String? = null
@JvmField
var key: String? = null
Expand Down Expand Up @@ -172,7 +170,7 @@ open class RealmUserModel : RealmObject() {
}

override fun toString(): String {
return "$firstName $lastName"
return "$name"
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import org.ole.planet.myplanet.R
import org.ole.planet.myplanet.databinding.RowJoinedUserBinding
import org.ole.planet.myplanet.model.RealmUserModel

class AdapterLeader(var context: Context, var leaders: List<RealmUserModel>) :
class AdapterLeader(var context: Context, private var leaders: List<RealmUserModel>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private lateinit var rowJoinedUserBinding: RowJoinedUserBinding
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
Expand All @@ -23,15 +24,15 @@ class AdapterLeader(var context: Context, var leaders: List<RealmUserModel>) :
if (leaders[position].firstName == null) {
holder.title.text = leaders[position].name
} else {
holder.title.text = "${leaders[position]}"
holder.title.text = context.getString(R.string.message_placeholder, leaders[position])
}
holder.tv_description.text = leaders[position].email
holder.tvDescription.text = leaders[position].email
}
}

internal inner class ViewHolderLeader(private val rowJoinedUserBinding: RowJoinedUserBinding) : RecyclerView.ViewHolder(rowJoinedUserBinding.root){
internal inner class ViewHolderLeader(rowJoinedUserBinding: RowJoinedUserBinding) : RecyclerView.ViewHolder(rowJoinedUserBinding.root){
var title= rowJoinedUserBinding.tvTitle
var tv_description= rowJoinedUserBinding.tvDescription
var tvDescription= rowJoinedUserBinding.tvDescription
var icon= rowJoinedUserBinding.icMore
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.fragment.app.Fragment
import com.google.android.material.tabs.TabLayoutMediator
import org.ole.planet.myplanet.databinding.FragmentTeamDetailBinding
import org.ole.planet.myplanet.service.UserProfileDbHandler
import org.ole.planet.myplanet.ui.sync.SyncActivity
import org.ole.planet.myplanet.utilities.Constants.PREFS_NAME
import org.ole.planet.myplanet.utilities.TimeUtils
import java.util.Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.ole.planet.myplanet.ui.courses

import android.os.Build
import android.os.Bundle
import android.text.Spannable
import android.text.method.LinkMovementMethod
import android.text.style.URLSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
import io.realm.Case
import io.realm.Realm
Expand Down Expand Up @@ -51,7 +53,6 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback {
stepId = requireArguments().getString("stepId")
stepNumber = requireArguments().getInt("stepNumber")
}
userVisibleHint = false
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
Expand Down Expand Up @@ -89,6 +90,7 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback {
}
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
step = cRealm.where(RealmCourseStep::class.java).equalTo("id", stepId).findFirst()!!
Expand All @@ -115,6 +117,9 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback {
textWithSpans.removeSpan(urlSpan)
}
}
if (isVisible && isMyCourse(user?.id, step.courseId, cRealm)) {
saveCourseProgress()
}
}

private fun hideTestIfNoQuestion() {
Expand Down Expand Up @@ -152,6 +157,7 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback {
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun setListeners() {
val notDownloadedResources: List<RealmMyLibrary> = cRealm.where(RealmMyLibrary::class.java).equalTo("stepId", stepId).equalTo("resourceOffline", false).isNotNull("resourceLocalAddress").findAll()
setResourceButton(notDownloadedResources, fragmentCourseStepBinding.btnResources)
Expand All @@ -175,6 +181,7 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback {
setOpenResourceButton(downloadedResources, fragmentCourseStepBinding.btnOpen)
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onDownloadComplete() {
super.onDownloadComplete()
setListeners()
Expand All @@ -184,7 +191,7 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback {

companion object {
fun prependBaseUrlToImages(markdownContent: String?, baseUrl: String): String {
val pattern = "!\\[.*?\\]\\((.*?)\\)"
val pattern = "!\\[.*?]\\((.*?)\\)"
val imagePattern = Pattern.compile(pattern)
val matcher = markdownContent?.let { imagePattern.matcher(it) }
val result = StringBuffer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener {
if (selectedTeamId?.isNotEmpty() == true) {
users = RealmMyTeam.getUsers(selectedTeamId, mRealm, "")
val userList = (users as? MutableList<RealmUserModel>)?.map {
User(it.getFullName(), it.name ?: "", "", it.userImage ?: "", "team")
User(it.name ?: "", it.name ?: "", "", it.userImage ?: "", "team")
} ?: emptyList()

val existingUsers = prefData.getSAVEDUSERS().toMutableList()
Expand Down

0 comments on commit c02b602

Please sign in to comment.