[Android] [PATCH 3/3] AudioBrowserListAdapter: merge items with different case

Thomas Guillem thomas at gllm.fr
Mon Jan 26 15:54:26 CET 2015


---
 .../videolan/vlc/gui/audio/AudioBrowserListAdapter.java    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
index 09c2b8f..5100c5c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserListAdapter.java
@@ -113,12 +113,13 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
     public void add(String title, String subTitle, MediaWrapper media) {
         if(title == null) return;
         title = title.trim();
+        final String titleKey = title.toLowerCase();
         if(subTitle != null) subTitle = subTitle.trim();
-        if (mMediaItemMap.containsKey(title))
-            mMediaItemMap.get(title).mMediaList.add(media);
+        if (mMediaItemMap.containsKey(titleKey))
+            mMediaItemMap.get(titleKey).mMediaList.add(media);
         else {
             ListItem item = new ListItem(title, subTitle, media, false);
-            mMediaItemMap.put(title, item);
+            mMediaItemMap.put(titleKey, item);
             mItems.add(item);
         }
     }
@@ -210,11 +211,12 @@ public class AudioBrowserListAdapter extends BaseAdapter implements SectionIndex
     public void addSeparator(String title, MediaWrapper media) {
         if(title == null) return;
         title = title.trim();
-        if (mSeparatorItemMap.containsKey(title))
-            mSeparatorItemMap.get(title).mMediaList.add(media);
+        final String titleKey = title.toLowerCase();
+        if (mSeparatorItemMap.containsKey(titleKey))
+            mSeparatorItemMap.get(titleKey).mMediaList.add(media);
         else {
             ListItem item = new ListItem(title, null, media, true);
-            mSeparatorItemMap.put(title, item);
+            mSeparatorItemMap.put(titleKey, item);
             mItems.add(item);
         }
     }
-- 
2.1.3



More information about the Android mailing list