[Android] Truncate start ov video files in groups

Geoffrey Métais git at videolan.org
Mon Dec 4 15:26:32 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec  4 15:25:50 2017 +0100| [517cfb4c88dab33d47b4e1e825c9f2176a7593d5] | committer: Geoffrey Métais

Truncate start ov video files in groups

See #431

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

 vlc-android/res/layout/video_list_card.xml                        | 1 -
 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 2 +-
 vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java  | 8 +++++++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/vlc-android/res/layout/video_list_card.xml b/vlc-android/res/layout/video_list_card.xml
index be512e9a4..b14ab25e3 100644
--- a/vlc-android/res/layout/video_list_card.xml
+++ b/vlc-android/res/layout/video_list_card.xml
@@ -90,7 +90,6 @@
             android:fontFamily="sans-serif-light"
             android:gravity="center_vertical"
             android:maxLines="2"
-            android:singleLine="true"
             android:paddingLeft="@dimen/half_default_margin"
             android:paddingStart="@dimen/half_default_margin"
             android:text="@{media.title}"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index b78e48f6d..4be925151 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -95,7 +95,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        mAdapter = new VideoListAdapter(this);
+        mAdapter = new VideoListAdapter(this, mGroup != null);
 
         if (savedInstanceState != null)
             setGroup(savedInstanceState.getString(KEY_GROUP));
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 33acf9729..f91219edf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -36,6 +36,7 @@ import android.view.ViewGroup;
 import android.widget.Filter;
 import android.widget.Filterable;
 import android.widget.ImageView;
+import android.widget.TextView;
 
 import org.videolan.medialibrary.Tools;
 import org.videolan.medialibrary.media.MediaLibraryItem;
@@ -71,13 +72,15 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
     private final ItemFilter mFilter = new ItemFilter();
     private int mSelectionCount = 0;
     private int mGridCardWidth = 0;
+    final boolean mGroup;
 
     private boolean mIsSeenMediaMarkerVisible = true;
 
-    VideoListAdapter(IEventsHandler eventsHandler) {
+    VideoListAdapter(IEventsHandler eventsHandler, boolean group) {
         super();
         mEventsHandler = eventsHandler;
         mIsSeenMediaMarkerVisible = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext()).getBoolean("media_seen", true);
+        mGroup = group;
     }
 
     @Override
@@ -102,6 +105,9 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
         fillView(holder, media);
         holder.binding.setVariable(BR.media, media);
         holder.selectView(media.hasStateFlags(MediaLibraryItem.FLAG_SELECTED));
+        final TextView titleView = holder.itemView.findViewById(R.id.ml_item_title);
+        titleView.setMaxLines(mGroup ? 1 : 2);
+        titleView.setEllipsize(mGroup ? TextUtils.TruncateAt.START : null);
     }
 
     @Override



More information about the Android mailing list