diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-12-14 18:04:32 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-12-14 18:04:32 -0800 |
commit | e22398a16d6c55f820fc8244b04dc868859435a6 (patch) | |
tree | c3645f0a558d590b55204748dd838e103324425b /app/src/main/java | |
parent | 257c59c85c0da4ea597bd70b52e2a7f26431dd23 (diff) | |
download | dsub-e22398a16d6c55f820fc8244b04dc868859435a6.tar.gz dsub-e22398a16d6c55f820fc8244b04dc868859435a6.tar.bz2 dsub-e22398a16d6c55f820fc8244b04dc868859435a6.zip |
Just sort folders on every view instead of refresh (will be needed if I decide to implement more sorting methods)
Diffstat (limited to 'app/src/main/java')
4 files changed, 4 insertions, 10 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java index 6dc56bb3..8983051e 100644 --- a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java @@ -126,6 +126,7 @@ public class MusicDirectory implements Serializable { } public void sortChildren(Context context, int instance) { + // Only apply sorting on server version 4.7 and greater, where disc is supported if(ServerInfo.checkServerVersion(context, "1.8", instance)) { sortChildren(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true)); } diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java index 34ba2513..b3dc4fea 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java @@ -201,6 +201,7 @@ public class CachedMusicService implements MusicService { // If a cached copy exists to check against, look for removes deleteRemovedEntries(context, dir, cached); } + dir.sortChildren(context, musicService.getInstance(context)); return dir; } @@ -220,6 +221,7 @@ public class CachedMusicService implements MusicService { // If a cached copy exists to check against, look for removes deleteRemovedEntries(context, dir, cached); } + dir.sortChildren(context, musicService.getInstance(context)); return dir; } @@ -240,6 +242,7 @@ public class CachedMusicService implements MusicService { // If a cached copy exists to check against, look for removes deleteRemovedEntries(context, dir, cached); } + dir.sortChildren(context, musicService.getInstance(context)); return dir; } @@ -493,8 +496,6 @@ public class CachedMusicService implements MusicService { // Only save if actually added to artist if (changed) { musicDirectory.replaceChildren(objects); - // Reapply sort after addition - musicDirectory.sortChildren(context, instance); FileUtil.serialize(context, musicDirectory, cacheName); } } diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java index 9af512e3..419ea69f 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java +++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java @@ -283,11 +283,6 @@ public class RESTMusicService implements MusicService { dir.addChildren(extra.getChildren()); } - // Apply another sort if we are chaining several together - if(dir != extra) { - dir.sortChildren(context, getInstance(context)); - } - return dir; } diff --git a/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java index f2d58b5d..bb1980b6 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java +++ b/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java @@ -103,9 +103,6 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser { } while (eventType != XmlPullParser.END_DOCUMENT); validate(); - - // Only apply sorting on server version 4.7 and greater, where disc is supported - dir.sortChildren(context, instance); return dir; } |