diff options
author | Scott Jackson <daneren2005@gmail.com> | 2016-05-04 21:56:38 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2016-05-04 21:56:38 -0700 |
commit | 403a0b8e6d0d45ffda1c32baa89c187876fa53ef (patch) | |
tree | 82f204f7c9086b940941141b10577eaf285f7de2 /app/src | |
parent | a351831caceb87c5da5599c8ad5eb633ea4d8264 (diff) | |
download | dsub-403a0b8e6d0d45ffda1c32baa89c187876fa53ef.tar.gz dsub-403a0b8e6d0d45ffda1c32baa89c187876fa53ef.tar.bz2 dsub-403a0b8e6d0d45ffda1c32baa89c187876fa53ef.zip |
#170 Add status indicator for playback speed
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java | 26 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 6 |
2 files changed, 28 insertions, 4 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java index 3831a4c0..87ccbd64 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -422,6 +422,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis } downloadService.setPlaybackSpeed(playbackSpeed); + updateTitle(); return true; } }); @@ -524,7 +525,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis menu.removeItem(R.id.menu_equalizer); } - if(isRemoteEnabled) { + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && isRemoteEnabled) { playbackSpeedButton.setVisibility(View.GONE); } else { playbackSpeedButton.setVisibility(View.VISIBLE); @@ -794,6 +795,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis downloadService.addOnSongChangedListener(NowPlayingFragment.this, true); } updateRepeatButton(); + updateTitle(); } }); } @@ -1255,6 +1257,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis rewindButton.setVisibility(View.GONE); fastforwardButton.setVisibility(View.GONE); } + updateTitle(); } private void setupSubtitle(int currentPlayingIndex) { @@ -1465,6 +1468,27 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis break; } } + private void updateTitle() { + DownloadService downloadService = getDownloadService(); + float playbackSpeed = downloadService.getPlaybackSpeed(); + + String title = context.getResources().getString(R.string.button_bar_now_playing); + int stringRes = -1; + if(playbackSpeed == 0.5f) { + stringRes = R.string.download_playback_speed_half; + } else if(playbackSpeed == 1.5f) { + stringRes = R.string.download_playback_speed_one_half; + } else if(playbackSpeed == 2.0f) { + stringRes = R.string.download_playback_speed_double; + } else if(playbackSpeed == 3.0f) { + stringRes = R.string.download_playback_speed_tripple; + } + + if(stringRes != -1) { + title += " (" + context.getResources().getString(stringRes) + ")"; + } + setTitle(title); + } @Override protected List<Entry> getSelectedEntries() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 896f3dac..6837a88b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -221,10 +221,10 @@ <string name="download.thumbs_down">Thumbs Down</string> <string name="download.batch_mode">Batch Mode</string> <string name="download.playback_speed_half">0.5x</string> - <string name="download.playback_speed_normal">1.0x</string> + <string name="download.playback_speed_normal">1x</string> <string name="download.playback_speed_one_half">1.5x</string> - <string name="download.playback_speed_double">2.0x</string> - <string name="download.playback_speed_tripple">3.0x</string> + <string name="download.playback_speed_double">2x</string> + <string name="download.playback_speed_tripple">3x</string> <string name="sync.new_podcasts">New podcasts available</string> <string name="sync.new_playlists">New songs in playlists</string> |