Skip to content

Commit

Permalink
all: smoother navigation highlighting (fixes #5070) (#5116)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
pavi38 and dogi authored Jan 24, 2025
1 parent 1d5211f commit 26d7f5c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 26
targetSdkVersion 34
versionCode 2238
versionName "0.22.38"
versionCode 2239
versionName "0.22.39"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 26d7f5c

Please sign in to comment.