aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-01-29 17:56:37 -0800
committerScott Jackson <daneren2005@gmail.com>2013-01-29 17:56:37 -0800
commitc60b6266bdfdac70f14438562704cc4f469edc25 (patch)
tree300f0c36c24b12a8fc2d42a302717f4477450cb2
parent940402465292f83e5bdc90e948b5e2a6e44a5026 (diff)
downloaddsub-c60b6266bdfdac70f14438562704cc4f469edc25.tar.gz
dsub-c60b6266bdfdac70f14438562704cc4f469edc25.tar.bz2
dsub-c60b6266bdfdac70f14438562704cc4f469edc25.zip
Sort artists with #'s last and not case sensitive like online searches
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 3d8a3881..c63fc0f3 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -77,6 +77,25 @@ public class OfflineMusicService extends RESTMusicService {
artists.add(artist);
}
}
+
+ Collections.sort(artists, new Comparator<Artist>() {
+ public int compare(Artist lhsArtist, Artist rhsArtist) {
+ String lhs = lhsArtist.getName().toLowerCase();
+ String rhs = rhsArtist.getName().toLowerCase();
+
+ char lhs1 = lhs.charAt(0);
+ char rhs1 = rhs.charAt(0);
+
+ if(Character.isDigit(lhs1) && !Character.isDigit(rhs1)) {
+ return 1;
+ } else if(Character.isDigit(rhs1) && !Character.isDigit(lhs1)) {
+ return -1;
+ }
+
+ return lhs.compareTo(rhs);
+ }
+ });
+
return new Indexes(0L, Collections.<Artist>emptyList(), artists);
}