[Android] [PATCH 10/12] Trim artist and album names to fix filtering

Geoffrey Métais geoffrey.metais at gmail.com
Mon Nov 17 17:06:48 CET 2014


---
 vlc-android/src/org/videolan/vlc/gui/tv/GridFragment.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/GridFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/GridFragment.java
index 373370b..de120d8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/GridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/GridFragment.java
@@ -18,7 +18,6 @@ import org.videolan.vlc.gui.audio.MediaComparators;
 import org.videolan.vlc.gui.tv.audioplayer.AudioPlayerActivity;
 import org.videolan.vlc.gui.video.VideoBrowserInterface;
 import org.videolan.vlc.gui.video.VideoListHandler;
-import org.videolan.vlc.gui.video.VideoPlayerActivity;
 import org.videolan.vlc.util.Util;
 
 import android.content.Context;
@@ -132,9 +131,10 @@ public class GridFragment extends VerticalGridFragment implements VideoBrowserIn
 			Collections.sort(audioList, MediaComparators.byAlbum);
 			for (Media media : audioList){
 				if (mFilter == null 
-						|| (mType == FILTER_ARTIST && mFilter.equals(media.getArtist()))
-						|| (mType == FILTER_GENRE && mFilter.equals(media.getGenre())))
+						|| (mType == FILTER_ARTIST && mFilter.equals(media.getArtist().trim()))
+						|| (mType == FILTER_GENRE && mFilter.equals(media.getGenre().trim()))) {
 				add(media.getAlbum(), media.getArtist(), media);
+				}
 			}
 			//Customize title for artist/genre browsing
 			if (mType == FILTER_ARTIST){
@@ -178,12 +178,12 @@ public class GridFragment extends VerticalGridFragment implements VideoBrowserIn
 					intent = new Intent(mContext, VerticalGridActivity.class);
 					intent.putExtra(AUDIO_CATEGORY, getString(R.string.albums));
 					intent.putExtra(MEDIA_SECTION, FILTER_ARTIST);
-					intent.putExtra(AUDIO_FILTER, listItem.mMediaList.get(0).getArtist());
+					intent.putExtra(AUDIO_FILTER, listItem.mMediaList.get(0).getArtist().trim());
 				} else if (getString(R.string.genres).equals(mCategory)){
 					intent = new Intent(mContext, VerticalGridActivity.class);
 					intent.putExtra(AUDIO_CATEGORY, getString(R.string.albums));
 					intent.putExtra(MEDIA_SECTION, FILTER_GENRE);
-					intent.putExtra(AUDIO_FILTER, listItem.mMediaList.get(0).getGenre());
+					intent.putExtra(AUDIO_FILTER, listItem.mMediaList.get(0).getGenre().trim());
 				} else {
 					ArrayList<String> locations = new ArrayList<String>();
 					for (Media media : listItem.mMediaList){
-- 
1.9.1



More information about the Android mailing list