diff options
author | Scott Jackson <daneren2005@gmail.com> | 2016-10-26 08:58:51 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2016-10-26 08:58:51 -0700 |
commit | c449f36e1c68f08acbf02bac48ffacded6534e1b (patch) | |
tree | e289c15316dbd5d97b2d16b9e1d42d13648b2b7f | |
parent | 61979e9893ce4bd5e4fdee1fc3349a04ccc7a8a7 (diff) | |
download | dsub-c449f36e1c68f08acbf02bac48ffacded6534e1b.tar.gz dsub-c449f36e1c68f08acbf02bac48ffacded6534e1b.tar.bz2 dsub-c449f36e1c68f08acbf02bac48ffacded6534e1b.zip |
Fixes #759: Don't change the track # for Top Tracks
3 files changed, 14 insertions, 3 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 1da3d51b..5f7b2412 100644 --- a/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java +++ b/app/src/main/java/github/daneren2005/dsub/domain/MusicDirectory.java @@ -236,6 +236,7 @@ public class MusicDirectory implements Serializable { private String album; private String artist; private Integer track; + private Integer customOrder; private Integer year; private String genre; private String contentType; @@ -424,6 +425,13 @@ public class MusicDirectory implements Serializable { this.track = track; } + public Integer getCustomOrder() { + return customOrder; + } + public void setCustomOrder(Integer customOrder) { + this.customOrder = customOrder; + } + public Integer getYear() { return year; } diff --git a/app/src/main/java/github/daneren2005/dsub/service/parser/TopSongsParser.java b/app/src/main/java/github/daneren2005/dsub/service/parser/TopSongsParser.java index c3719782..2d1f43dc 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/parser/TopSongsParser.java +++ b/app/src/main/java/github/daneren2005/dsub/service/parser/TopSongsParser.java @@ -34,17 +34,17 @@ public class TopSongsParser extends MusicDirectoryEntryParser { MusicDirectory dir = new MusicDirectory(); int eventType; - int trackNumber = 1; + int customOrder = 1; do { eventType = nextParseEvent(); if (eventType == XmlPullParser.START_TAG) { String name = getElementName(); if ("song".equals(name)) { MusicDirectory.Entry entry = parseEntry(""); - entry.setTrack(trackNumber); + entry.setCustomOrder(customOrder); dir.addChild(entry); - trackNumber++; + customOrder++; } else if ("error".equals(name)) { handleError(); } diff --git a/app/src/main/java/github/daneren2005/dsub/view/SongView.java b/app/src/main/java/github/daneren2005/dsub/view/SongView.java index 7a02c91d..320c5933 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/SongView.java +++ b/app/src/main/java/github/daneren2005/dsub/view/SongView.java @@ -151,6 +151,9 @@ public class SongView extends UpdateView2<MusicDirectory.Entry, Boolean> { String title = song.getTitle(); Integer track = song.getTrack(); + if(song.getCustomOrder() != null) { + track = song.getCustomOrder(); + } TextView newPlayingTextView; if(track != null && Util.getDisplayTrack(context)) { trackTextView.setText(String.format("%02d", track)); |