diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-06-12 13:50:14 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-06-12 13:50:14 -0700 |
commit | 417d2b047cad0b7e68a1420b3fd7e9189f314409 (patch) | |
tree | f8ebbe5407d6151d7b20cd90282e04a59f55d6f3 /subsonic-android | |
parent | f3dde60ac3f6fac612360732717f1411bc854059 (diff) | |
download | dsub-417d2b047cad0b7e68a1420b3fd7e9189f314409.tar.gz dsub-417d2b047cad0b7e68a1420b3fd7e9189f314409.tar.bz2 dsub-417d2b047cad0b7e68a1420b3fd7e9189f314409.zip |
Add option to display track number in front of song titles
Diffstat (limited to 'subsonic-android')
5 files changed, 21 insertions, 1 deletions
diff --git a/subsonic-android/res/values/strings.xml b/subsonic-android/res/values/strings.xml index 019f6d84..48a30059 100644 --- a/subsonic-android/res/values/strings.xml +++ b/subsonic-android/res/values/strings.xml @@ -210,6 +210,8 @@ <string name="settings.theme_dark_fullscreen">Dark Fullscreen</string>
<string name="settings.theme_black_fullscreen">Black Fullscreen</string>
<string name="settings.theme_holo_fullscreen">Holo Fullscreen</string>
+ <string name="settings.track_title">Display Track #</string>
+ <string name="settings.track_summary">Display Track # in front of songs if one exists</string>
<string name="settings.network_title">Network</string>
<string name="settings.max_bitrate_wifi">Max Audio bitrate - Wi-Fi</string>
<string name="settings.max_bitrate_mobile">Max Audio bitrate - Mobile</string>
diff --git a/subsonic-android/res/xml/settings.xml b/subsonic-android/res/xml/settings.xml index d3618ffa..af2b567a 100644 --- a/subsonic-android/res/xml/settings.xml +++ b/subsonic-android/res/xml/settings.xml @@ -23,6 +23,12 @@ android:entryValues="@array/themeValues" android:entries="@array/themeNames"/> + <CheckBoxPreference + android:title="@string/settings.track_title" + android:summary="@string/settings.track_summary" + android:key="displayTrack" + android:defaultValue="false"/> + </PreferenceCategory> <PreferenceCategory diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java index 0eeb37c9..2ed5f2a8 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Constants.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Constants.java @@ -76,6 +76,7 @@ public final class Constants { public static final String PREFERENCES_KEY_PASSWORD = "password"; 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_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"; diff --git a/subsonic-android/src/github/daneren2005/dsub/util/Util.java b/subsonic-android/src/github/daneren2005/dsub/util/Util.java index 1603924b..d0bac8f5 100644 --- a/subsonic-android/src/github/daneren2005/dsub/util/Util.java +++ b/subsonic-android/src/github/daneren2005/dsub/util/Util.java @@ -279,6 +279,11 @@ public final class Util { SharedPreferences prefs = getPreferences(context); return prefs.getString(Constants.PREFERENCES_KEY_THEME, null); } + + public static boolean getDisplayTrack(Context context) { + SharedPreferences prefs = getPreferences(context); + return prefs.getBoolean(Constants.PREFERENCES_KEY_DISPLAY_TRACK, false); + } public static int getMaxBitrate(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); diff --git a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java index 40bedad6..b4ec2f19 100644 --- a/subsonic-android/src/github/daneren2005/dsub/view/SongView.java +++ b/subsonic-android/src/github/daneren2005/dsub/view/SongView.java @@ -93,8 +93,14 @@ public class SongView extends UpdateView implements Checkable { } else { artist.append(String.format(getContext().getString(R.string.song_details_all), bitRate == null ? "" : bitRate, fileFormat)); } + + String title = song.getTitle(); + Integer track = song.getTrack(); + if(track != null && Util.getDisplayTrack(context)) { + title = String.format("%02d", track) + " " + title; + } - titleTextView.setText(song.getTitle()); + titleTextView.setText(title); artistTextView.setText(artist); durationTextView.setText(Util.formatDuration(song.getDuration())); checkedTextView.setVisibility(checkable && !song.isVideo() ? View.VISIBLE : View.GONE); |