[Android] Show filenames in browser

Geoffrey Métais git at videolan.org
Tue Sep 25 14:58:11 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Sep 25 14:43:28 2018 +0200| [14862ae490e97d4ea5c338015672252d75812a14] | committer: Geoffrey Métais

Show filenames in browser

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

 vlc-android/res/layout/browser_item.xml                              | 5 ++++-
 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 3 +--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/browser_item.xml b/vlc-android/res/layout/browser_item.xml
index 95284fc19..5cdd57f6e 100644
--- a/vlc-android/res/layout/browser_item.xml
+++ b/vlc-android/res/layout/browser_item.xml
@@ -13,6 +13,9 @@
         <variable
             name="item"
             type="MediaLibraryItem"/>
+        <variable
+            name="filename"
+            type="String"/>
         <variable
             name="hasContextMenu"
             type="boolean"/>
@@ -95,7 +98,7 @@
             android:ellipsize="end"
             android:singleLine="true"
             android:maxLines="1"
-            android:text="@{item.title}"
+            android:text="@{filename ?? item.title}"
             android:textColor="?attr/list_title"
             android:textSize="16sp"
             android:lineSpacingMultiplier="1.1" />
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 dbd28d024..760c1a2d5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -28,7 +28,6 @@ import android.graphics.BitmapFactory;
 import android.graphics.drawable.BitmapDrawable;
 import android.net.Uri;
 import android.os.Build;
-import android.support.annotation.MainThread;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -51,7 +50,6 @@ import org.videolan.vlc.util.Constants;
 import java.util.ArrayList;
 import java.util.List;
 
-import static org.videolan.medialibrary.media.MediaLibraryItem.FLAG_SELECTED;
 import static org.videolan.medialibrary.media.MediaLibraryItem.TYPE_MEDIA;
 import static org.videolan.medialibrary.media.MediaLibraryItem.TYPE_STORAGE;
 
@@ -127,6 +125,7 @@ public class BaseBrowserAdapter extends DiffUtilAdapter<MediaLibraryItem, BaseBr
         vh.binding.setHasContextMenu((!mNetworkRoot || isFavorite)
                 && !"content".equals(media.getUri().getScheme())
                 && !"otg".equals(media.getUri().getScheme()));
+        if (media.getType() != MediaWrapper.TYPE_DIR) vh.binding.setFilename(media.getFileName());
         if (mNetworkRoot) vh.binding.setProtocol(getProtocol(media));
         vh.binding.setCover(getIcon(media, mSpecialIcons));
         vh.selectView(multiSelectHelper.isSelected(position));



More information about the Android mailing list