aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-07-22 20:26:21 -0700
committerScott Jackson <daneren2005@gmail.com>2015-07-22 20:26:21 -0700
commitc04ae69ec580c7d86eed872626cc98bdd2769c81 (patch)
tree2e92574ee64fba0b18d8186af730788386c20806 /app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
parentfbd1a68042dfc3601eaa0a9e37b3957bbdd51420 (diff)
downloaddsub-c04ae69ec580c7d86eed872626cc98bdd2769c81.tar.gz
dsub-c04ae69ec580c7d86eed872626cc98bdd2769c81.tar.bz2
dsub-c04ae69ec580c7d86eed872626cc98bdd2769c81.zip
#506 Show sleep time remaining
Diffstat (limited to 'app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java16
1 files changed, 12 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 bec43a22..c754f370 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java
@@ -131,6 +131,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
private boolean scrollWhenLoaded = false;
private int lastY = 0;
private int currentPlayingSize = 0;
+ private MenuItem timerMenu;
/**
* Called when the activity is first created.
@@ -525,10 +526,11 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
menuInflater.inflate(R.menu.nowplaying_offline, menu);
} else {
menuInflater.inflate(R.menu.nowplaying, menu);
-
- if(downloadService != null && downloadService.getSleepTimer()) {
- menu.findItem(R.id.menu_toggle_timer).setTitle(R.string.download_stop_timer);
- }
+ }
+ if(downloadService != null && downloadService.getSleepTimer()) {
+ int timeRemaining = downloadService.getSleepTimeRemaining();
+ timerMenu = menu.findItem(R.id.menu_toggle_timer);
+ timerMenu.setTitle(context.getResources().getString(R.string.download_stop_time_remaining, Util.formatDuration(timeRemaining)));
}
if(downloadService != null && downloadService.getKeepScreenOn()) {
menu.findItem(R.id.menu_screen_on_off).setChecked(true);
@@ -1380,6 +1382,12 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis
progressBar.setProgress(0);
progressBar.setEnabled(false);
}
+
+ DownloadService downloadService = getDownloadService();
+ if(downloadService.getSleepTimer() && timerMenu != null) {
+ int timeRemaining = downloadService.getSleepTimeRemaining();
+ timerMenu.setTitle(context.getResources().getString(R.string.download_stop_time_remaining, Util.formatDuration(timeRemaining)));
+ }
}
@Override