diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-05-18 21:47:32 -0400 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-05-18 21:47:32 -0400 |
commit | 3301342a761f614370a15afabeaf28a0b364913a (patch) | |
tree | 6908a463b27eb1b255bad2b2ed23b5bbe1e419b5 /app/src/main | |
parent | 14435c1aee38ae4c5982d5ab8ef6f26d7f21fb99 (diff) | |
parent | 77272708550f89066766c4f9f12cb743b918e8fe (diff) | |
download | AntennaPod-3301342a761f614370a15afabeaf28a0b364913a.zip |
Merge pull request #816 from mfietz/issue/802-widget-old-progress
Widget: Show correct played and total when current episode ends
Diffstat (limited to 'app/src/main')
-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 { |