From 2f0d82998b1af7b8d2057ac4e4d6d9baf1847fa4 Mon Sep 17 00:00:00 2001 From: Vivian Li <112584985+strawberrybread@users.noreply.github.com> Date: Tue, 9 Jul 2024 11:36:54 -0400 Subject: [PATCH 1/3] courses: smoother steps (fixes #3789) (#3790) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../planet/myplanet/ui/courses/CourseStepFragment.kt | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 965ab1eb33..3fb4d54968 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1660 - versionName "0.16.60" + versionCode 1661 + versionName "0.16.61" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/courses/CourseStepFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/courses/CourseStepFragment.kt index e2a44d1c8d..8e6cd8be51 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/courses/CourseStepFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/courses/CourseStepFragment.kt @@ -1,5 +1,6 @@ package org.ole.planet.myplanet.ui.courses +import android.os.Build import android.os.Bundle import android.text.Spannable import android.text.method.LinkMovementMethod @@ -7,6 +8,7 @@ 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 @@ -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 { @@ -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()!! @@ -115,6 +117,9 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback { textWithSpans.removeSpan(urlSpan) } } + if (isVisible && isMyCourse(user?.id, step.courseId, cRealm)) { + saveCourseProgress() + } } private fun hideTestIfNoQuestion() { @@ -152,6 +157,7 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback { } } + @RequiresApi(Build.VERSION_CODES.O) private fun setListeners() { val notDownloadedResources: List = cRealm.where(RealmMyLibrary::class.java).equalTo("stepId", stepId).equalTo("resourceOffline", false).isNotNull("resourceLocalAddress").findAll() setResourceButton(notDownloadedResources, fragmentCourseStepBinding.btnResources) @@ -175,6 +181,7 @@ class CourseStepFragment : BaseContainerFragment(), ImageCaptureCallback { setOpenResourceButton(downloadedResources, fragmentCourseStepBinding.btnOpen) } + @RequiresApi(Build.VERSION_CODES.O) override fun onDownloadComplete() { super.onDownloadComplete() setListeners() @@ -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() From 020db62b641e356822bf33a7d7964756de75beae Mon Sep 17 00:00:00 2001 From: Elijah Whang <59347000+ewhang5@users.noreply.github.com> Date: Tue, 9 Jul 2024 10:43:12 -0500 Subject: [PATCH 2/3] community: smoother tabs (fixes #3797) (#3798) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../ole/planet/myplanet/ui/community/AdapterLeader.kt | 11 ++++++----- .../myplanet/ui/community/CommunityTabFragment.kt | 1 - 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3fb4d54968..d4bf5b9ceb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1661 - versionName "0.16.61" + versionCode 1662 + versionName "0.16.62" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/community/AdapterLeader.kt b/app/src/main/java/org/ole/planet/myplanet/ui/community/AdapterLeader.kt index c340cdf688..f3e6a0cf1a 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/community/AdapterLeader.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/community/AdapterLeader.kt @@ -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) : +class AdapterLeader(var context: Context, private var leaders: List) : RecyclerView.Adapter() { private lateinit var rowJoinedUserBinding: RowJoinedUserBinding override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { @@ -23,15 +24,15 @@ class AdapterLeader(var context: Context, var leaders: List) : 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 } } \ No newline at end of file diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/community/CommunityTabFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/community/CommunityTabFragment.kt index 36c550e783..200fa92e22 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/community/CommunityTabFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/community/CommunityTabFragment.kt @@ -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 From 091cc83615da0822f7dc9257bf24d1a874fcd6a0 Mon Sep 17 00:00:00 2001 From: Vivian Li <112584985+strawberrybread@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:00:29 -0400 Subject: [PATCH 3/3] login: show members username (fixes #3787) (#3788) Co-authored-by: Gideon Okuro Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../main/java/org/ole/planet/myplanet/model/RealmUserModel.kt | 4 +--- .../java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d4bf5b9ceb..f681b3144a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1662 - versionName "0.16.62" + versionCode 1663 + versionName "0.16.63" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/model/RealmUserModel.kt b/app/src/main/java/org/ole/planet/myplanet/model/RealmUserModel.kt index 451265b823..9d7fb5dca2 100644 --- a/app/src/main/java/org/ole/planet/myplanet/model/RealmUserModel.kt +++ b/app/src/main/java/org/ole/planet/myplanet/model/RealmUserModel.kt @@ -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 @@ -172,7 +170,7 @@ open class RealmUserModel : RealmObject() { } override fun toString(): String { - return "$firstName $lastName" + return "$name" } companion object { diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt index 8a979e97ad..b29fabd589 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/LoginActivity.kt @@ -259,7 +259,7 @@ class LoginActivity : SyncActivity(), TeamListAdapter.OnItemClickListener { if (selectedTeamId?.isNotEmpty() == true) { users = RealmMyTeam.getUsers(selectedTeamId, mRealm, "") val userList = (users as? MutableList)?.map { - User(it.getFullName(), it.name ?: "", "", it.userImage ?: "", "team") + User(it.name ?: "", it.name ?: "", "", it.userImage ?: "", "team") } ?: emptyList() val existingUsers = prefData.getSAVEDUSERS().toMutableList()