[Android] Show special browser icons in internal memory dir

Geoffrey Métais git at videolan.org
Mon Nov 6 18:24:53 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov  6 18:16:58 2017 +0100| [ed0cc8680e42d463d55d732bf5e8c5ac0ddf0e30] | committer: Geoffrey Métais

Show special browser icons in internal memory dir

(cherry picked from commit b659d74a1f51ca4f773f7ebd84cc21bc3f86f6a6)

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index ddb8d18a3..3b98dbec1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -76,13 +76,16 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
     protected final BaseBrowserFragment fragment;
     private int mTop = 0, mMediaCount = 0, mSelectionCount = 0;
     private ItemFilter mFilter = new ItemFilter();
-    private final boolean mFilesRoot, mNetworkRoot;
+    private final boolean mFilesRoot, mNetworkRoot, mSpecialIcons;
 
     BaseBrowserAdapter(BaseBrowserFragment fragment) {
         this.fragment = fragment;
         final boolean root = fragment.isRootDirectory();
-        mFilesRoot = root && fragment instanceof FileBrowserFragment;
+        final boolean fileBrowser = fragment instanceof FileBrowserFragment;
+        mFilesRoot = root && fileBrowser;
         mNetworkRoot = root && fragment instanceof NetworkBrowserFragment;
+        final String mrl = fragment.mMrl;
+        mSpecialIcons = mFilesRoot || fileBrowser && mrl != null && mrl.endsWith(AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
     }
 
     @Override
@@ -122,7 +125,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
         vh.binding.setHasContextMenu(true);
         if (mNetworkRoot)
             vh.binding.setProtocol(getProtocol(media));
-        vh.binding.setCover(getIcon(media, mFilesRoot));
+        vh.binding.setCover(getIcon(media, mSpecialIcons));
         vh.setContextMenuListener();
         vh.selectView(media.hasStateFlags(FLAG_SELECTED));
     }



More information about the Android mailing list