mute-buton in queue layout and logic, but no icon change

This commit is contained in:
karol 2020-02-23 23:31:30 +01:00
parent cc559dc9ce
commit 2a63f2a3a6
3 changed files with 44 additions and 9 deletions

View File

@ -83,6 +83,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private TextView seekDisplay; private TextView seekDisplay;
private ImageButton repeatButton; private ImageButton repeatButton;
private ImageButton muteButton;
private ImageButton backwardButton; private ImageButton backwardButton;
private ImageButton playPauseButton; private ImageButton playPauseButton;
private ImageButton forwardButton; private ImageButton forwardButton;
@ -305,6 +306,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private void buildControls() { private void buildControls() {
repeatButton = rootView.findViewById(R.id.control_repeat); repeatButton = rootView.findViewById(R.id.control_repeat);
muteButton = rootView.findViewById(R.id.control_mute);
backwardButton = rootView.findViewById(R.id.control_backward); backwardButton = rootView.findViewById(R.id.control_backward);
playPauseButton = rootView.findViewById(R.id.control_play_pause); playPauseButton = rootView.findViewById(R.id.control_play_pause);
forwardButton = rootView.findViewById(R.id.control_forward); 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); progressBar = rootView.findViewById(R.id.control_progress_bar);
repeatButton.setOnClickListener(this); repeatButton.setOnClickListener(this);
muteButton.setOnClickListener(this);
backwardButton.setOnClickListener(this); backwardButton.setOnClickListener(this);
playPauseButton.setOnClickListener(this); playPauseButton.setOnClickListener(this);
forwardButton.setOnClickListener(this); forwardButton.setOnClickListener(this);
@ -446,6 +449,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
if (view.getId() == repeatButton.getId()) { if (view.getId() == repeatButton.getId()) {
player.onRepeatClicked(); player.onRepeatClicked();
} else if (view.getId() == muteButton.getId()) {
player.onMuteUnmuteButtonClicled();
} else if (view.getId() == backwardButton.getId()) { } else if (view.getId() == backwardButton.getId()) {
player.onPlayPrevious(); player.onPlayPrevious();
@ -661,7 +667,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
final int shuffleAlpha = shuffled ? 255 : 77; final int shuffleAlpha = shuffled ? 255 : 77;
shuffleButton.setImageAlpha(shuffleAlpha); shuffleButton.setImageAlpha(shuffleAlpha);
} }
private void onPlaybackParameterChanged(final PlaybackParameters parameters) { private void onPlaybackParameterChanged(final PlaybackParameters parameters) {
if (parameters != null) { if (parameters != null) {
playbackSpeedButton.setText(formatSpeed(parameters.speed)); playbackSpeedButton.setText(formatSpeed(parameters.speed));

View File

@ -192,7 +192,7 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/control_repeat" android:layout_toLeftOf="@+id/control_mute"
android:gravity="center" android:gravity="center"
android:minWidth="50dp" android:minWidth="50dp"
android:text="1x" android:text="1x"
@ -201,13 +201,30 @@
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
tools:ignore="HardcodedText,RtlHardcoded"/> tools:ignore="HardcodedText,RtlHardcoded"/>
<ImageButton
android:id="@+id/control_mute"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_toLeftOf="@+id/control_repeat"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_volume_off_white_72dp"
android:tint="@color/gray"
tools:ignore="ContentDescription"/>
<ImageButton <ImageButton
android:id="@+id/control_repeat" android:id="@+id/control_repeat"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_toLeftOf="@+id/anchor"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
@ -216,16 +233,12 @@
android:src="@drawable/ic_repeat_white" android:src="@drawable/ic_repeat_white"
tools:ignore="ContentDescription"/> tools:ignore="ContentDescription"/>
<View android:layout_width="10dp"
android:layout_height="1dp"
android:layout_centerInParent="true"
android:id="@+id/anchor"/>
<ImageButton <ImageButton
android:id="@+id/control_shuffle" android:id="@+id/control_shuffle"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_toRightOf="@+id/anchor" android:layout_toRightOf="@+id/control_repeat"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"

View File

@ -176,7 +176,7 @@
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/control_repeat" android:layout_toLeftOf="@+id/control_mute"
android:gravity="center" android:gravity="center"
android:minWidth="50dp" android:minWidth="50dp"
android:text="1x" android:text="1x"
@ -185,6 +185,22 @@
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
tools:ignore="HardcodedText,RtlHardcoded"/> tools:ignore="HardcodedText,RtlHardcoded"/>
<ImageButton
android:id="@+id/control_mute"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_toLeftOf="@+id/control_repeat"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:scaleType="fitXY"
app:srcCompat="@drawable/ic_volume_off_white_72dp"
android:tint="@color/gray"
tools:ignore="ContentDescription"/>
<ImageButton <ImageButton
android:id="@+id/control_repeat" android:id="@+id/control_repeat"
android:layout_width="30dp" android:layout_width="30dp"