diff options
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/OfflineMusicService.java | 19 |
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); } |