aboutsummaryrefslogtreecommitdiff
path: root/src/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-12-16 07:39:54 -0800
committerScott Jackson <daneren2005@gmail.com>2013-12-16 07:39:54 -0800
commit928d8f8ce811fd4557bdbe946c082eb25c498b4b (patch)
treee4071d9e67938f67a9c0cf9901e45bbac8e0c948 /src/github
parent0538eb437649b80392badddb6105e8a5e360152e (diff)
downloaddsub-928d8f8ce811fd4557bdbe946c082eb25c498b4b.tar.gz
dsub-928d8f8ce811fd4557bdbe946c082eb25c498b4b.tar.bz2
dsub-928d8f8ce811fd4557bdbe946c082eb25c498b4b.zip
Sort genres
Diffstat (limited to 'src/github')
-rw-r--r--src/github/daneren2005/dsub/domain/Genre.java22
-rw-r--r--src/github/daneren2005/dsub/service/parser/GenreParser.java2
2 files changed, 23 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/domain/Genre.java b/src/github/daneren2005/dsub/domain/Genre.java
index 8c705e31..25d226d7 100644
--- a/src/github/daneren2005/dsub/domain/Genre.java
+++ b/src/github/daneren2005/dsub/domain/Genre.java
@@ -1,6 +1,15 @@
package github.daneren2005.dsub.domain;
+import android.content.Context;
+import android.content.SharedPreferences;
+
import java.io.Serializable;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import github.daneren2005.dsub.util.Constants;
+import github.daneren2005.dsub.util.Util;
public class Genre implements Serializable {
private String name;
@@ -26,4 +35,17 @@ public class Genre implements Serializable {
public String toString() {
return name;
}
+
+ public static class GenreComparator implements Comparator<Genre> {
+ @Override
+ public int compare(Genre genre1, Genre genre2) {
+ return genre1.getName().compareToIgnoreCase(genre2.getName());
+ }
+
+ public static List<Genre> sort(List<Genre> genres) {
+ Collections.sort(genres, new GenreComparator());
+ return genres;
+ }
+
+ }
}
diff --git a/src/github/daneren2005/dsub/service/parser/GenreParser.java b/src/github/daneren2005/dsub/service/parser/GenreParser.java
index 1062d3af..126f887b 100644
--- a/src/github/daneren2005/dsub/service/parser/GenreParser.java
+++ b/src/github/daneren2005/dsub/service/parser/GenreParser.java
@@ -117,6 +117,6 @@ public class GenreParser extends AbstractParser {
validate();
updateProgress(progressListener, R.string.parser_reading_done);
- return result;
+ return Genre.GenreComparator.sort(result);
}
}