Update playback position every second

This commit is contained in:
Martin Fietz 2016-01-21 13:18:20 +01:00
parent b492a1c1c1
commit 20bbc075fc
2 changed files with 5 additions and 5 deletions

View File

@ -128,7 +128,7 @@ public class PlayerWidgetService extends Service {
views.setTextViewText(R.id.txtvTitle, media.getEpisodeTitle());
String progressString = getProgressString(media);
String progressString = getProgressString();
if (progressString != null) {
views.setViewVisibility(R.id.txtvProgress, View.VISIBLE);
views.setTextViewText(R.id.txtvProgress, progressString);
@ -181,9 +181,9 @@ public class PlayerWidgetService extends Service {
return PendingIntent.getBroadcast(this, 0, startingIntent, 0);
}
private String getProgressString(Playable media) {
int position = media.getPosition();
int duration = media.getDuration();
private String getProgressString() {
int position = playbackService.getCurrentPosition();
int duration = playbackService.getDuration();
if (position > 0 && duration > 0) {
return Converter.getDurationStringLong(position) + " / "
+ Converter.getDurationStringLong(duration);

View File

@ -39,7 +39,7 @@ public class PlaybackServiceTaskManager {
/**
* Notification interval of widget updater in milliseconds.
*/
public static final int WIDGET_UPDATER_NOTIFICATION_INTERVAL = 1500;
public static final int WIDGET_UPDATER_NOTIFICATION_INTERVAL = 1000;
private static final int SCHED_EX_POOL_SIZE = 2;
private final ScheduledThreadPoolExecutor schedExecutor;