[Android] Show the FAB on tablet for non main activities

Nicolas Pomepuy git at videolan.org
Tue Nov 8 17:17:34 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Nov  7 13:40:47 2022 +0100| [4b20c3db77588b778405575ae99fc12cf89b2c9d] | committer: Duncan McNamara

Show the FAB on tablet for non main activities

Fixes #2743

> https://code.videolan.org/videolan/vlc-android/commit/4b20c3db77588b778405575ae99fc12cf89b2c9d
---

 application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
index 50db7f16e..e51d1f2f5 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
@@ -73,7 +73,7 @@ abstract class BaseFragment : Fragment(), ActionMode.Callback {
             it.setProgressBackgroundColorSchemeColor(bColor)
         }
         val fab = requireActivity().findViewById<FloatingActionButton?>(R.id.fab)
-        ((fab?.layoutParams as? CoordinatorLayout.LayoutParams)?.behavior as? FloatingActionButtonBehavior)?.shouldNeverShow = !hasFAB()
+        ((fab?.layoutParams as? CoordinatorLayout.LayoutParams)?.behavior as? FloatingActionButtonBehavior)?.shouldNeverShow = !hasFAB() && requireActivity() is MainActivity
         if (hasFAB()) updateFabPlayView()
     }
 
@@ -90,7 +90,7 @@ abstract class BaseFragment : Fragment(), ActionMode.Callback {
         val fabLarge = requireActivity().findViewById<FloatingActionButton>(R.id.fab_large)
         fab.setGone()
         fabLarge.setGone()
-        fabPlay = if (requireActivity().isTablet()) fabLarge else fab
+        fabPlay = if (requireActivity().isTablet() && requireActivity() is MainActivity) fabLarge else fab
         visibility?.let { fabPlay?.visibility = it }
     }
 



More information about the Android mailing list