From 20bbc075fc076a1ee2a8c62ccc398db794ebaf7d Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Thu, 21 Jan 2016 13:18:20 +0100 Subject: [PATCH] Update playback position every second --- .../de/danoeh/antennapod/service/PlayerWidgetService.java | 8 ++++---- .../core/service/playback/PlaybackServiceTaskManager.java | 2 +- 2 files changed, 5 insertions(+), 5 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 d61a189c2..323060f81 100644 --- a/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java +++ b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java @@ -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); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java index 4e0c8a109..680fb8777 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java @@ -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;