[Android] Hide nomedia option for now

Geoffrey Métais git at videolan.org
Tue May 12 15:01:50 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue May 12 15:01:18 2015 +0200| [853a430e2c194b405e61610293bd1aed241c6d8d] | committer: Geoffrey Métais

Hide nomedia option for now

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

 vlc-android/res/layout/mrl_panel.xml               |    1 +
 vlc-android/res/menu/directory_view_dir.xml        |   12 +++---
 .../vlc/gui/browser/BaseBrowserFragment.java       |   40 ++++++++++----------
 3 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/vlc-android/res/layout/mrl_panel.xml b/vlc-android/res/layout/mrl_panel.xml
index 3492035..529edf1 100644
--- a/vlc-android/res/layout/mrl_panel.xml
+++ b/vlc-android/res/layout/mrl_panel.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/mrl_root"
     android:layout_width="match_parent" android:layout_height="match_parent">
     <EditText
         android:id="@+id/mrl_edit"
diff --git a/vlc-android/res/menu/directory_view_dir.xml b/vlc-android/res/menu/directory_view_dir.xml
index 9dca7ba..aba57ae 100644
--- a/vlc-android/res/menu/directory_view_dir.xml
+++ b/vlc-android/res/menu/directory_view_dir.xml
@@ -3,10 +3,10 @@
     <item
         android:id="@+id/directory_view_play_folder"
         android:title="@string/play" />
-    <item
-        android:id="@+id/directory_view_hide_media"
-        android:title="@string/directory_hide_medialib" />
-    <item
-        android:id="@+id/directory_view_show_media"
-        android:title="@string/directory_show_medialib" />
+    <!--<item-->
+        <!--android:id="@+id/directory_view_hide_media"-->
+        <!--android:title="@string/directory_hide_medialib" />-->
+    <!--<item-->
+        <!--android:id="@+id/directory_view_show_media"-->
+        <!--android:title="@string/directory_show_medialib" />-->
 </menu>
\ No newline at end of file
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 5c6a5fe..ac708b2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -340,22 +340,22 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
 
     protected void setContextMenu(MenuInflater inflater, Menu menu, int position) {
         MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
-        boolean canWrite = Util.canWrite(mw.getLocation());
         if (mw.getType() == MediaWrapper.TYPE_AUDIO || mw.getType() == MediaWrapper.TYPE_VIDEO) {
+            boolean canWrite = Util.canWrite(mw.getLocation());
             inflater.inflate(R.menu.directory_view_file, menu);
             menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
         } else if (mw.getType() == MediaWrapper.TYPE_DIR) {
             boolean isEmpty = mMediaLists.get(position) == null || mMediaLists.get(position).isEmpty();
-            if (canWrite || !isEmpty) {
+            if (/*canWrite || */!isEmpty) {
                 inflater.inflate(R.menu.directory_view_dir, menu);
-                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);
-                }
+//                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);
             }
 
@@ -426,16 +426,16 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
                 }
                 Util.openList(getActivity(), mediaList, 0);
                 return true;
-            case R.id.directory_view_hide_media:
-                try {
-                    if (new File(mw.getLocation()+"/.nomedia").createNewFile())
-                        updateLib();
-                } catch (IOException e) {}
-                return true;
-            case R.id.directory_view_show_media:
-                if (new File(mw.getLocation()+"/.nomedia").delete())
-                    updateLib();
-                return true;
+//            case R.id.directory_view_hide_media:
+//                try {
+//                    if (new File(mw.getLocation()+"/.nomedia").createNewFile())
+//                        updateLib();
+//                } catch (IOException e) {}
+//                return true;
+//            case R.id.directory_view_show_media:
+//                if (new File(mw.getLocation()+"/.nomedia").delete())
+//                    updateLib();
+//                return true;
         }
         return false;
     }



More information about the Android mailing list