[Android] Inside a video group, display the title without the group name

Alexandre Perraud git at videolan.org
Mon Nov 20 10:33:16 CET 2017


vlc-android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu Nov 16 09:33:19 2017 +0100| [71e6ca9cda7385dfcec569b1564ba83732329acb] | committer: Alexandre Perraud

Inside a video group, display the title without the group name

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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..fb460fa21 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -74,6 +74,7 @@ import org.videolan.vlc.util.Util;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Pattern;
 
 public class VideoGridFragment extends SortableFragment<VideoListAdapter> implements MediaUpdatedCb, SwipeRefreshLayout.OnRefreshListener, MediaAddedCb, Filterable, IEventsHandler {
 
@@ -365,8 +366,11 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
                 if (mGroup != null) {
                     for (MediaWrapper item : itemList) {
                         String title = item.getTitle().substring(item.getTitle().toLowerCase().startsWith("the") ? 4 : 0);
-                        if (mGroup == null || title.toLowerCase().startsWith(mGroup.toLowerCase()))
+                        if (title.toLowerCase().startsWith(mGroup.toLowerCase())) {
+                            //Display title without the group name
+                            item.setDisplayTitle(title.replaceFirst(Pattern.quote(mGroup), "\u2026"));
                             displayList.add(item);
+                        }
                     }
                 } else {
                     for (MediaGroup item : MediaGroup.group(itemList))



More information about the Android mailing list