Skip to content

Commit

Permalink
resources: smoother navigation (fixes #5315) (#5331)
Browse files Browse the repository at this point in the history
Co-authored-by: Gideon Okuro <[email protected]>
Co-authored-by: dogi <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2025
1 parent 5d07d95 commit 5f86b87
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 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 2325
versionName "0.23.25"
versionCode 2326
versionName "0.23.26"
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 @@ -97,7 +97,7 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
tvSelected.visibility = View.VISIBLE
}
initArrays()
updateTvDelete()
hideButton()

if(userModel?.isGuest() == true){
tvAddToLib.visibility = View.GONE
Expand Down Expand Up @@ -157,7 +157,7 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
checkList()

selectAll.setOnClickListener {
updateTvDelete()
hideButton()
val allSelected = selectedItems?.size == adapterLibrary.getLibraryList().size
adapterLibrary.selectAllItems(!allSelected)
if (allSelected) {
Expand All @@ -184,8 +184,17 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
homeItemClickListener = context
}
}
private fun updateTvDelete(){

private fun hideButton(){
tvDelete?.isEnabled = selectedItems?.size!! != 0
tvAddToLib.isEnabled = selectedItems?.size!! != 0
if(selectedItems?.size!! != 0){
if(isMyCourseLib) tvDelete?.visibility = View.VISIBLE
else tvAddToLib.visibility = View.VISIBLE
} else {
if(isMyCourseLib) tvDelete?.visibility = View.GONE
else tvAddToLib.visibility = View.GONE
}
}

private fun checkList() {
Expand Down Expand Up @@ -266,7 +275,7 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
override fun onSelectedListChange(list: MutableList<RealmMyLibrary?>) {
selectedItems = list
changeButtonStatus()
updateTvDelete()
hideButton()
}

override fun onTagClicked(realmTag: RealmTag) {
Expand Down Expand Up @@ -413,4 +422,4 @@ class ResourcesFragment : BaseRecyclerFragment<RealmMyLibrary?>(), OnLibraryItem
orderByDate.setOnClickListener { adapterLibrary.toggleSortOrder() }
orderByTitle.setOnClickListener { adapterLibrary.toggleTitleSortOrder() }
}
}
}

0 comments on commit 5f86b87

Please sign in to comment.