From da2c94a50ca5d678e589cf4d22555c248f1c622f Mon Sep 17 00:00:00 2001 From: Pavneet Singh Cheema <90737218+pavi38@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:33:50 -0600 Subject: [PATCH 1/2] dashboard: smoother navigation highlight (fixes #5070) --- .../planet/myplanet/callback/OnHomeItemClickListener.kt | 1 + .../myplanet/ui/dashboard/BellDashboardFragment.kt | 4 ++-- .../planet/myplanet/ui/dashboard/DashboardActivity.kt | 9 ++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/ole/planet/myplanet/callback/OnHomeItemClickListener.kt b/app/src/main/java/org/ole/planet/myplanet/callback/OnHomeItemClickListener.kt index 65f6b0dbaf..22ea6372fd 100644 --- a/app/src/main/java/org/ole/planet/myplanet/callback/OnHomeItemClickListener.kt +++ b/app/src/main/java/org/ole/planet/myplanet/callback/OnHomeItemClickListener.kt @@ -5,6 +5,7 @@ import org.ole.planet.myplanet.model.RealmMyLibrary import org.ole.planet.myplanet.model.RealmStepExam interface OnHomeItemClickListener { + fun openMyFragment(f: Fragment) fun openCallFragment(f: Fragment) fun openLibraryDetailFragment(library: RealmMyLibrary?) fun showRatingDialog(type: String?, resourceId: String?, title: String?, listener: OnRatingChangeListener?) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BellDashboardFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BellDashboardFragment.kt index 73990b2219..d142080ddc 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BellDashboardFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/BellDashboardFragment.kt @@ -218,14 +218,14 @@ class BellDashboardFragment : BaseDashboardFragment() { if (user?.id?.startsWith("guest") == true) { guestDialog(requireContext()) } else { - openHelperFragment(ResourcesFragment()) + homeItemClickListener?.openMyFragment(ResourcesFragment()) } } fragmentHomeBellBinding.homeCardCourses.myCoursesImageButton.setOnClickListener { if (user?.id?.startsWith("guest") == true) { guestDialog(requireContext()) } else { - openHelperFragment(CoursesFragment()) + homeItemClickListener?.openMyFragment(CoursesFragment()) } } fragmentHomeBellBinding.fabMyActivity.setOnClickListener { openHelperFragment(MyActivityFragment()) } diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt index 6df1c66749..57dccd2607 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt @@ -796,12 +796,19 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N } } - fun openMyFragment(f: Fragment) { + override fun openMyFragment(f: Fragment) { val b = Bundle() b.putBoolean("isMyCourseLib", true) f.arguments = b val fragmentName = f::class.java.simpleName val tag = "My$fragmentName" + when (tag) { + "MyCoursesFragment" -> result?.setSelection(2, false) + "MyResourcesFragment" -> result?.setSelection(1, false) + else -> { + result?.setSelection(0, false) + } + } openCallFragment(f, tag) } From 0e0ccf54487de4dbc2c96663d639cd4870fd3937 Mon Sep 17 00:00:00 2001 From: Pavneet Singh Cheema <90737218+pavi38@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:41:53 -0600 Subject: [PATCH 2/2] added updates to the .lite file --- .../myplanet/ui/dashboard/DashboardActivity.kt.lite | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite index 8dca97ce96..d4285b02f1 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite +++ b/app/src/main/java/org/ole/planet/myplanet/ui/dashboard/DashboardActivity.kt.lite @@ -796,12 +796,19 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N } } - fun openMyFragment(f: Fragment) { + override fun openMyFragment(f: Fragment) { val b = Bundle() b.putBoolean("isMyCourseLib", true) f.arguments = b val fragmentName = f::class.java.simpleName val tag = "My$fragmentName" + when (tag) { + "MyCoursesFragment" -> result?.setSelection(2, false) + "MyResourcesFragment" -> result?.setSelection(1, false) + else -> { + result?.setSelection(0, false) + } + } openCallFragment(f, tag) }