From 72af51fe9d2256aa8bb39d90c58f83bea2a42d94 Mon Sep 17 00:00:00 2001 From: TheLastGimbus Date: Sun, 14 Jun 2020 15:16:04 +0200 Subject: [PATCH] Add speed button to top bar --- .../org/schabi/newpipe/player/ServicePlayerActivity.java | 8 +++++++- app/src/main/res/menu/menu_play_queue.xml | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java index 0d355d61f..195f0da95 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -164,6 +164,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity case R.id.action_append_playlist: appendAllToPlaylist(); return true; + case R.id.action_playback_speed: + openPlaybackParameterDialog(); + return true; case R.id.action_mute: player.onMuteUnmuteButtonClicked(); return true; @@ -688,7 +691,10 @@ public abstract class ServicePlayerActivity extends AppCompatActivity private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { - Log.d("Dupa", "12"); + if (menu != null && player != null) { + MenuItem item = menu.findItem(R.id.action_playback_speed); + item.setTitle(formatSpeed(parameters.speed)); + } } } diff --git a/app/src/main/res/menu/menu_play_queue.xml b/app/src/main/res/menu/menu_play_queue.xml index fc3fd07a8..76385a140 100644 --- a/app/src/main/res/menu/menu_play_queue.xml +++ b/app/src/main/res/menu/menu_play_queue.xml @@ -10,6 +10,14 @@ android:visible="true" app:showAsAction="ifRoom"/> + + +