aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-11-15 22:31:14 -0800
committerScott Jackson <daneren2005@gmail.com>2013-11-15 22:31:14 -0800
commit37dbce51cc62948f680ec9dd1a9abba4d5a36004 (patch)
treeea31836c148947b236b42d85a50f88b71aa53e0e
parenta2dbaa1b4c715ae8bfd72399079f0632575c8a3b (diff)
downloaddsub-37dbce51cc62948f680ec9dd1a9abba4d5a36004.tar.gz
dsub-37dbce51cc62948f680ec9dd1a9abba4d5a36004.tar.bz2
dsub-37dbce51cc62948f680ec9dd1a9abba4d5a36004.zip
Revert changes for #153
-rw-r--r--src/github/daneren2005/dsub/domain/MusicDirectory.java31
-rw-r--r--src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java5
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
3 files changed, 6 insertions, 31 deletions
diff --git a/src/github/daneren2005/dsub/domain/MusicDirectory.java b/src/github/daneren2005/dsub/domain/MusicDirectory.java
index 724beed2..0b9be5fb 100644
--- a/src/github/daneren2005/dsub/domain/MusicDirectory.java
+++ b/src/github/daneren2005/dsub/domain/MusicDirectory.java
@@ -96,10 +96,7 @@ public class MusicDirectory implements Serializable {
}
public void sortChildren() {
- EntryComparator.sort(children, false);
- }
- public void sortChildren(boolean sortByYear) {
- EntryComparator.sort(children, sortByYear);
+ EntryComparator.sort(children);
}
public static class Entry implements Serializable {
@@ -367,33 +364,13 @@ public class MusicDirectory implements Serializable {
}
public static class EntryComparator implements Comparator<Entry> {
- private boolean sortByYear = false;
-
- EntryComparator(boolean byYear) {
- sortByYear = byYear;
- }
-
public int compare(Entry lhs, Entry rhs) {
if(lhs.isDirectory() && !rhs.isDirectory()) {
return -1;
} else if(!lhs.isDirectory() && rhs.isDirectory()) {
return 1;
} else if(lhs.isDirectory() && rhs.isDirectory()) {
- if(sortByYear) {
- Integer lhsYear = lhs.getYear();
- Integer rhsYear = rhs.getYear();
- if(lhsYear != null && rhsYear != null) {
- return lhsYear.compareTo(rhsYear);
- } else if(lhsYear != null) {
- return -1;
- } else if(rhsYear != null) {
- return 1;
- } else {
- return lhs.getTitle().compareToIgnoreCase(rhs.getTitle());
- }
- } else {
- return lhs.getTitle().compareToIgnoreCase(rhs.getTitle());
- }
+ return lhs.getTitle().compareToIgnoreCase(rhs.getTitle());
}
Integer lhsDisc = lhs.getDiscNumber();
@@ -420,9 +397,9 @@ public class MusicDirectory implements Serializable {
return lhs.getTitle().compareToIgnoreCase(rhs.getTitle());
}
- public static void sort(List<Entry> entries, boolean sortByYear) {
+ public static void sort(List<Entry> entries) {
try {
- Collections.sort(entries, new EntryComparator(sortByYear));
+ Collections.sort(entries, new EntryComparator());
} catch (Exception e) {
Log.w(TAG, "Failed to sort MusicDirectory");
}
diff --git a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
index 56740d2d..a8755d58 100644
--- a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
+++ b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
@@ -22,7 +22,6 @@ import android.content.Context;
import android.util.Log;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory;
-import github.daneren2005.dsub.domain.Version;
import github.daneren2005.dsub.util.ProgressListener;
import github.daneren2005.dsub.util.Util;
import org.xmlpull.v1.XmlPullParser;
@@ -72,7 +71,7 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser {
// Only apply sorting on server version 4.7 and greater, where disc is supported
if(Util.checkServerVersion(context, "1.8.0")) {
- dir.sortChildren(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_SORT_BY_YEAR, false));
+ dir.sortChildren();
}
long t1 = System.currentTimeMillis();
@@ -80,4 +79,4 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser {
return dir;
}
-}
+} \ No newline at end of file
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java
index 7fc6d09f..d4c99017 100644
--- a/src/github/daneren2005/dsub/util/Constants.java
+++ b/src/github/daneren2005/dsub/util/Constants.java
@@ -84,7 +84,6 @@ public final class Constants {
public static final String PREFERENCES_KEY_INSTALL_TIME = "installTime";
public static final String PREFERENCES_KEY_THEME = "theme";
public static final String PREFERENCES_KEY_DISPLAY_TRACK = "displayTrack";
- public static final String PREFERENCES_KEY_SORT_BY_YEAR = "sortByYear";
public static final String PREFERENCES_KEY_MAX_BITRATE_WIFI = "maxBitrateWifi";
public static final String PREFERENCES_KEY_MAX_BITRATE_MOBILE = "maxBitrateMobile";
public static final String PREFERENCES_KEY_MAX_VIDEO_BITRATE_WIFI = "maxVideoBitrateWifi";