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

Alexandre Perraud git at videolan.org
Tue Nov 21 11:25:39 CET 2017


vlc-android | branch: 2.5.x | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu Nov 16 09:33:19 2017 +0100| [a15dcf259b197d26f5ab60b63ccffd53cbe1a02a] | committer: Geoffrey Métais

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

(cherry picked from commit 71e6ca9cda7385dfcec569b1564ba83732329acb)

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

 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