From 458c60d6915ba46b788b2e96bcc3df9f56988d3c Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Thu, 10 Jul 2014 20:20:33 -0700 Subject: Change sort option to be sort by year or by alphabetical --- src/github/daneren2005/dsub/domain/MusicDirectory.java | 4 ++-- src/github/daneren2005/dsub/service/OfflineMusicService.java | 2 +- src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java index 363a1540..492726f9 100644 --- a/src/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java @@ -102,8 +102,8 @@ public class MusicDirectory implements Serializable { return children.size(); } - public void sortChildren() { - EntryComparator.sort(children); + public void sortChildren(boolean byYear) { + EntryComparator.sort(children, byYear); } public static class Entry implements Serializable { diff --git a/src/github/daneren2005/dsub/service/OfflineMusicService.java b/src/github/daneren2005/dsub/service/OfflineMusicService.java index a92e41d1..04955cc3 100644 --- a/src/github/daneren2005/dsub/service/OfflineMusicService.java +++ b/src/github/daneren2005/dsub/service/OfflineMusicService.java @@ -134,7 +134,7 @@ public class OfflineMusicService extends RESTMusicService { result.addChild(createEntry(context, file, name, true, isPodcast)); } } - result.sortChildren(); + result.sortChildren(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true)); return result; } diff --git a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java index e705c54d..95ee1744 100644 --- a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java +++ b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java @@ -97,8 +97,8 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser { validate(); // Only apply sorting on server version 4.7 and greater, where disc is supported - if(Util.checkServerVersion(context, "1.8.0") && Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true)) { - dir.sortChildren(); + if(Util.checkServerVersion(context, "1.8.0")) { + dir.sortChildren(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_CUSTOM_SORT_ENABLED, true)); } return dir; -- cgit v1.2.3