From 2a63f2a3a633b18d87f4874f11d6961ad2e5a907 Mon Sep 17 00:00:00 2001 From: karol Date: Sun, 23 Feb 2020 23:31:30 +0100 Subject: [PATCH] mute-buton in queue layout and logic, but no icon change --- .../newpipe/player/ServicePlayerActivity.java | 8 +++++- .../activity_player_queue_control.xml | 27 ++++++++++++++----- .../layout/activity_player_queue_control.xml | 18 ++++++++++++- 3 files changed, 44 insertions(+), 9 deletions(-) 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 7aa2be05d..034746a2b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -83,6 +83,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity private TextView seekDisplay; private ImageButton repeatButton; + private ImageButton muteButton; private ImageButton backwardButton; private ImageButton playPauseButton; private ImageButton forwardButton; @@ -305,6 +306,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity private void buildControls() { repeatButton = rootView.findViewById(R.id.control_repeat); + muteButton = rootView.findViewById(R.id.control_mute); backwardButton = rootView.findViewById(R.id.control_backward); playPauseButton = rootView.findViewById(R.id.control_play_pause); forwardButton = rootView.findViewById(R.id.control_forward); @@ -314,6 +316,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity progressBar = rootView.findViewById(R.id.control_progress_bar); repeatButton.setOnClickListener(this); + muteButton.setOnClickListener(this); backwardButton.setOnClickListener(this); playPauseButton.setOnClickListener(this); forwardButton.setOnClickListener(this); @@ -446,6 +449,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity if (view.getId() == repeatButton.getId()) { player.onRepeatClicked(); + } else if (view.getId() == muteButton.getId()) { + player.onMuteUnmuteButtonClicled(); + } else if (view.getId() == backwardButton.getId()) { player.onPlayPrevious(); @@ -661,7 +667,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity final int shuffleAlpha = shuffled ? 255 : 77; shuffleButton.setImageAlpha(shuffleAlpha); } - + private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { playbackSpeedButton.setText(formatSpeed(parameters.speed)); diff --git a/app/src/main/res/layout-land/activity_player_queue_control.xml b/app/src/main/res/layout-land/activity_player_queue_control.xml index 6468c6784..0277c28b5 100644 --- a/app/src/main/res/layout-land/activity_player_queue_control.xml +++ b/app/src/main/res/layout-land/activity_player_queue_control.xml @@ -192,7 +192,7 @@ android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_centerVertical="true" - android:layout_toLeftOf="@+id/control_repeat" + android:layout_toLeftOf="@+id/control_mute" android:gravity="center" android:minWidth="50dp" android:text="1x" @@ -201,13 +201,30 @@ android:background="?attr/selectableItemBackground" tools:ignore="HardcodedText,RtlHardcoded"/> + + - + +