diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2015-05-14 17:44:54 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2015-05-14 17:44:54 +0200 |
commit | 77272708550f89066766c4f9f12cb743b918e8fe (patch) | |
tree | 5858e78ad5fee82cbba1aecd15e939a05c2050d8 /app | |
parent | 73c4dfc04db814e6f2b4b2234150a404c2ec6cfa (diff) | |
download | AntennaPod-77272708550f89066766c4f9f12cb743b918e8fe.zip |
Widget: Show correct played and total when current episode ends
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java index 0d00823d3..1fe9e2cf9 100644 --- a/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java +++ b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java @@ -117,11 +117,12 @@ public class PlayerWidgetService extends Service { views.setTextViewText(R.id.txtvTitle, media.getEpisodeTitle()); + String progressString = getProgressString(media); + if (progressString != null) { + views.setTextViewText(R.id.txtvProgress, progressString); + } + if (status == PlayerStatus.PLAYING) { - String progressString = getProgressString(playbackService); - if (progressString != null) { - views.setTextViewText(R.id.txtvProgress, progressString); - } views.setImageViewResource(R.id.butPlay, R.drawable.ic_pause_white_24dp); if (Build.VERSION.SDK_INT >= 15) { views.setContentDescription(R.id.butPlay, getString(R.string.pause_label)); @@ -157,11 +158,10 @@ public class PlayerWidgetService extends Service { return PendingIntent.getBroadcast(this, 0, startingIntent, 0); } - private String getProgressString(PlaybackService ps) { - int position = ps.getCurrentPosition(); - int duration = ps.getDuration(); - if (position != PlaybackService.INVALID_TIME - && duration != PlaybackService.INVALID_TIME) { + private String getProgressString(Playable media) { + int position = media.getPosition(); + int duration = media.getDuration(); + if (position > 0 && duration > 0) { return Converter.getDurationStringLong(position) + " / " + Converter.getDurationStringLong(duration); } else { |