From a5cbaad8040621c429e111bd48b9287de287fbd5 Mon Sep 17 00:00:00 2001 From: SpajicM Date: Thu, 8 Jun 2017 16:58:50 +0200 Subject: [PATCH] BackgroundPlayer: Add timestamp in expanded notification --- .../newpipe/player/BackgroundPlayer.java | 7 +++-- .../layout/player_notification_expanded.xml | 27 +++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java index cbf4f2bf6..d41fa1ef7 100644 --- a/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/BackgroundPlayer.java @@ -286,15 +286,13 @@ public class BackgroundPlayer extends Service { public void onPrepared(boolean playWhenReady) { super.onPrepared(playWhenReady); if (simpleExoPlayer.getDuration() < 15000) { - PROGRESS_LOOP_INTERVAL = 1000; FAST_FORWARD_REWIND_AMOUNT = 2000; } else if (simpleExoPlayer.getDuration() > 60 * 60 * 1000) { - PROGRESS_LOOP_INTERVAL = 2000; FAST_FORWARD_REWIND_AMOUNT = 60000; } else { - PROGRESS_LOOP_INTERVAL = 2000; FAST_FORWARD_REWIND_AMOUNT = 10000; } + PROGRESS_LOOP_INTERVAL = 1000; basePlayerImpl.getPlayer().setVolume(1f); } @@ -323,6 +321,7 @@ public class BackgroundPlayer extends Service { public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) { if (bigNotRemoteView != null) bigNotRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); if (notRemoteView != null) notRemoteView.setProgressBar(R.id.notificationProgressBar, duration, currentProgress, false); + if (bigNotRemoteView != null) bigNotRemoteView.setTextViewText(R.id.notificationTime, getTimeString(currentProgress) + " / " + getTimeString(duration)); updateNotification(-1); } @@ -452,4 +451,4 @@ public class BackgroundPlayer extends Service { releaseWifiAndCpu(); } } -} \ No newline at end of file +} diff --git a/app/src/main/res/layout/player_notification_expanded.xml b/app/src/main/res/layout/player_notification_expanded.xml index 22b0fd153..841bdd4cf 100644 --- a/app/src/main/res/layout/player_notification_expanded.xml +++ b/app/src/main/res/layout/player_notification_expanded.xml @@ -76,6 +76,20 @@ tools:ignore="RtlHardcoded" tools:progress="52"/> + + @@ -242,4 +253,4 @@ android:layout_alignParentLeft="true" /> ---> \ No newline at end of file +-->