[Android] Fix FAB visibility

Geoffrey Métais git at videolan.org
Tue Nov 27 16:52:06 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 27 16:46:11 2018 +0100| [255edda0e5c9ede4465d3ecdc738847343c01720] | committer: Geoffrey Métais

Fix FAB visibility

Fix #628

> https://code.videolan.org/videolan/vlc-android/commit/255edda0e5c9ede4465d3ecdc738847343c01720
---

 .../org/videolan/vlc/gui/browser/MediaBrowserFragment.java   | 12 ++++++++++--
 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java    |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index 696387130..7821b73be 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -117,6 +117,12 @@ public abstract class MediaBrowserFragment<T extends SortableModel> extends Frag
         }
     }
 
+    @Override
+    public void onStop() {
+        super.onStop();
+        setFabPlayVisibility(false);
+    }
+
     public void updateActionBar() {
         final AppCompatActivity activity = (AppCompatActivity)getActivity();
         if (activity == null) return;
@@ -135,8 +141,10 @@ public abstract class MediaBrowserFragment<T extends SortableModel> extends Frag
     }
 
     public void setFabPlayVisibility(boolean enable) {
-        if (enable == (mFabPlay.getVisibility() == View.VISIBLE)) return;
-        if (mFabPlay != null) mFabPlay.setVisibility(enable ? View.VISIBLE : View.GONE);
+        if (mFabPlay != null) {
+            if (enable) mFabPlay.show();
+            else mFabPlay.hide();
+        }
     }
 
     public void onFabPlayClick(View view) {}
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 5bff93c5e..019773726 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -140,8 +140,8 @@ public class VideoGridFragment extends MediaBrowserFragment<VideosModel> impleme
         registerForContextMenu(mBinding.videoGrid);
         setSearchVisibility(false);
         updateViewMode();
-        mFabPlay.setImageResource(R.drawable.ic_fab_play);
         setFabPlayVisibility(true);
+        mFabPlay.setImageResource(R.drawable.ic_fab_play);
         if (restart) viewModel.refresh();
     }
 



More information about the Android mailing list