[Android] Code cleaning

Geoffrey Métais git at videolan.org
Wed May 25 18:43:42 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 25 18:32:24 2016 +0200| [a857ca8fb24cc097fe82afa9dd2e7254865d14cc] | committer: Geoffrey Métais

Code cleaning

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

 vlc-android/src/org/videolan/vlc/media/MediaGroup.java | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/media/MediaGroup.java b/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
index 91cc044..38b9fbb 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
@@ -33,8 +33,7 @@ public class MediaGroup extends MediaWrapper {
 
     private ArrayList<MediaWrapper> mMedias;
 
-    public MediaGroup(MediaWrapper media)
-    {
+    public MediaGroup(MediaWrapper media) {
         super(media.getUri(),
                 media.getTime(),
                 media.getLength(),
@@ -92,19 +91,18 @@ public class MediaGroup extends MediaWrapper {
         return groups;
     }
 
-    private static void insertInto(ArrayList<MediaGroup> groups, MediaWrapper media)
-    {
+    private static void insertInto(ArrayList<MediaGroup> groups, MediaWrapper media) {
         for (MediaGroup mediaGroup : groups) {
             String group = mediaGroup.getTitle();
-            String item = media.getTitle();
+            String title = media.getTitle();
 
-            if (item.length() > 4 && (item.startsWith("The") || item.startsWith("the")))
-                item = item.substring(4);
+            if (title.length() > 4 && (title.substring(0, 3).toLowerCase().startsWith("the")))
+                title = title.substring(4);
 
             // find common prefix
             int commonLength = 0;
-            int minLength = Math.min(group.length(), item.length());
-            while (commonLength < minLength && group.charAt(commonLength) == item.charAt(commonLength))
+            int minLength = Math.min(group.length(), title.length());
+            while (commonLength < minLength && group.charAt(commonLength) == title.charAt(commonLength))
                 ++commonLength;
 
             if (commonLength >= MIN_GROUP_LENGTH) {



More information about the Android mailing list