[Android] Fix TV browser fragment toolbar disappearing on sort change

Nicolas Pomepuy git at videolan.org
Wed May 15 14:16:09 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed May 15 15:11:04 2024 +0200| [3fe0cdd98d2bbe9dc63ffcfb6dcdf4c6802453bb] | committer: Duncan McNamara

Fix TV browser fragment toolbar disappearing on sort change

Fixes #3068

> https://code.videolan.org/videolan/vlc-android/commit/3fe0cdd98d2bbe9dc63ffcfb6dcdf4c6802453bb
---

 .../java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt     | 2 ++
 .../java/org/videolan/television/ui/browser/BaseBrowserTvFragment.kt    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt b/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt
index fc895ad5a5..1c5adf9407 100644
--- a/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/MediaBrowserAnimatorDelegate.kt
@@ -130,6 +130,8 @@ internal class MediaBrowserAnimatorDelegate(val binding: SongBrowserBinding, pri
         }
     }
 
+    fun isFABExpanded() = currenstate == MediaBrowserState.SCROLLED_DOWN_FAB_EXPANDED
+
     internal fun expandExtendedFAB() {
         currenstate = MediaBrowserState.SCROLLED_DOWN_FAB_EXPANDED
     }
diff --git a/application/television/src/main/java/org/videolan/television/ui/browser/BaseBrowserTvFragment.kt b/application/television/src/main/java/org/videolan/television/ui/browser/BaseBrowserTvFragment.kt
index cebd521513..abae503af8 100644
--- a/application/television/src/main/java/org/videolan/television/ui/browser/BaseBrowserTvFragment.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/browser/BaseBrowserTvFragment.kt
@@ -336,7 +336,7 @@ abstract class BaseBrowserTvFragment<T> : Fragment(), BrowserFragmentInterface,
     }
 
     override fun onMenuItemClick(item: MenuItem): Boolean {
-        animationDelegate.collapseExtendedFAB()
+        if (animationDelegate.isFABExpanded()) animationDelegate.collapseExtendedFAB()
         when (item.itemId) {
             R.id.ml_menu_sortby_name -> {
                 sortBy(Medialibrary.SORT_ALPHA)



More information about the Android mailing list