[Android] Hide FAB if no video

Geoffrey Métais git at videolan.org
Thu Dec 15 10:17:53 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 14 16:54:19 2016 +0100| [2b9cba5453a73d3be6b0784f2bd7dbd45e1cb7a7] | committer: Geoffrey Métais

Hide FAB if no video

> https://code.videolan.org/videolan/vlc-android/commit/2b9cba5453a73d3be6b0784f2bd7dbd45e1cb7a7
---

 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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 a447ede..e37bc1b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -35,7 +35,6 @@ import android.os.Handler;
 import android.os.Message;
 import android.preference.PreferenceManager;
 import android.support.annotation.MainThread;
-import android.support.design.widget.FloatingActionButton;
 import android.support.v4.content.LocalBroadcastManager;
 import android.support.v7.view.ActionMode;
 import android.support.v7.widget.RecyclerView;
@@ -96,8 +95,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
     private VideoListAdapter mVideoAdapter;
     private DividerItemDecoration mDividerItemDecoration;
 
-    private FloatingActionButton mFabPlayAll;
-
     /* All subclasses of Fragment must include a public empty constructor. */
     public VideoGridFragment() { }
 
@@ -149,7 +146,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
     public void onStart() {
         super.onStart();
         mFabPlay.setImageResource(R.drawable.ic_fab_play);
-        setFabPlayVisibility(true);
         registerForContextMenu(mGridView);
     }
 
@@ -447,6 +443,11 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
         mVideoAdapter.clear();
     }
 
+    @Override
+    public void setFabPlayVisibility(boolean enable) {
+        super.setFabPlayVisibility(!mVideoAdapter.isEmpty() && enable);
+    }
+
     boolean mParsing = false;
     @Override
     public void onDiscoveryStarted(String entryPoint) {}
@@ -626,5 +627,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements MediaUpda
     @Override
     public void onUpdateFinished(RecyclerView.Adapter adapter) {
         updateEmptyView();
+        setFabPlayVisibility(true);
     }
 }



More information about the Android mailing list