[Android] Fix context menu in directory browser

Geoffrey Métais git at videolan.org
Tue Mar 31 11:12:29 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 31 11:12:02 2015 +0200| [12f9c6018a9a49de9e1b4f89a169d6331e5a4e8f] | committer: Geoffrey Métais

Fix context menu in directory browser

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

 vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java |    3 ++-
 vlc-android/src/org/videolan/vlc/util/Util.java            |    5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index e08eb54..91f82c5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -371,7 +371,8 @@ public class DirectoryAdapter extends BaseAdapter {
         else
             holder.icon.setImageResource(R.drawable.ic_menu_folder);
 
-        holder.more.setVisibility(Util.canWrite(mCurrentDir+"/"+selectedNode.name) ? View.VISIBLE : View.INVISIBLE);
+        holder.more.setVisibility(selectedNode.isFile() ||
+                Util.canWrite(mCurrentDir+"/"+selectedNode.name) ? View.VISIBLE : View.INVISIBLE);
         holder.more.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index dc35556..7a297a1 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -310,8 +310,9 @@ public class Util {
     public static boolean canWrite(String path){
         if (path == null)
             return false;
-        if (LibVlcUtil.isLolliPopOrLater() &&
-                !path.startsWith("file://" + Environment.getExternalStorageDirectory().getPath()))
+        if (path.startsWith(Environment.getExternalStorageDirectory().getPath()))
+            return true;
+        if (LibVlcUtil.isLolliPopOrLater())
             return false;
         File file = new File(path);
         return (file.exists() && file.canWrite());



More information about the Android mailing list