[Android] Hide 'play folder' option for empty folders

Geoffrey Métais git at videolan.org
Thu May 7 16:29:24 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May  7 11:53:37 2015 +0200| [57666eed82d07816398f744faf47368409064067] | committer: Geoffrey Métais

Hide 'play folder' option for empty folders

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=57666eed82d07816398f744faf47368409064067
---

 .../videolan/vlc/gui/browser/BaseBrowserFragment.java  |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 0f2e9a9..9419330 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -346,12 +346,20 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
             inflater.inflate(R.menu.directory_view_file, menu);
             menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
         } else if (mw.getType() == MediaWrapper.TYPE_DIR) {
-            if (canWrite) {
+            boolean isEmpty = mMediaLists.get(position).isEmpty();
+            if (canWrite || !isEmpty) {
                 inflater.inflate(R.menu.directory_view_dir, menu);
-                boolean nomedia = new File(mw.getLocation() + "/.nomedia").exists();
-                menu.findItem(R.id.directory_view_hide_media).setVisible(!nomedia);
-                menu.findItem(R.id.directory_view_show_media).setVisible(nomedia);
+                if (canWrite) {
+                    boolean nomedia = new File(mw.getLocation() + "/.nomedia").exists();
+                    menu.findItem(R.id.directory_view_hide_media).setVisible(!nomedia);
+                    menu.findItem(R.id.directory_view_show_media).setVisible(nomedia);
+                } else {
+                    menu.findItem(R.id.directory_view_hide_media).setVisible(false);
+                    menu.findItem(R.id.directory_view_show_media).setVisible(false);
+                }
+                menu.findItem(R.id.directory_view_play_folder).setVisible(!isEmpty);
             }
+
         }
     }
 



More information about the Android mailing list