[Android] AudioBrowserListAdapter: merge items with different case
Thomas Guillem
git at videolan.org
Mon Jan 26 16:00:01 CET 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jan 26 15:52:39 2015 +0100| [4d9228466260e3d349924b2129171f9180d385bb] | committer: Thomas Guillem
AudioBrowserListAdapter: merge items with different case
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=4d9228466260e3d349924b2129171f9180d385bb
---
.../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);
}
}
More information about the Android
mailing list