Skip to content

Commit 1ae8a72

Browse files
mute icon change in action bar
1 parent 840bb29 commit 1ae8a72

4 files changed

Lines changed: 19 additions & 51 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
8888
private TextView seekDisplay;
8989

9090
private ImageButton repeatButton;
91-
private ImageButton muteButton;
9291
private ImageButton backwardButton;
9392
private ImageButton playPauseButton;
9493
private ImageButton forwardButton;
@@ -319,7 +318,6 @@ private void buildSeekBar() {
319318

320319
private void buildControls() {
321320
repeatButton = rootView.findViewById(R.id.control_repeat);
322-
muteButton = rootView.findViewById(R.id.control_mute);
323321
backwardButton = rootView.findViewById(R.id.control_backward);
324322
playPauseButton = rootView.findViewById(R.id.control_play_pause);
325323
forwardButton = rootView.findViewById(R.id.control_forward);
@@ -329,7 +327,6 @@ private void buildControls() {
329327
progressBar = rootView.findViewById(R.id.control_progress_bar);
330328

331329
repeatButton.setOnClickListener(this);
332-
muteButton.setOnClickListener(this);
333330
backwardButton.setOnClickListener(this);
334331
playPauseButton.setOnClickListener(this);
335332
forwardButton.setOnClickListener(this);
@@ -462,10 +459,7 @@ public void onClick(View view) {
462459
if (view.getId() == repeatButton.getId()) {
463460
player.onRepeatClicked();
464461

465-
} else if (view.getId() == muteButton.getId()) {
466-
player.onMuteUnmuteButtonClicked();
467-
468-
} else if (view.getId() == backwardButton.getId()) {
462+
} else if (view.getId() == backwardButton.getId()) {
469463
player.onPlayPrevious();
470464

471465
} else if (view.getId() == playPauseButton.getId()) {
@@ -698,9 +692,7 @@ private void onMaybePlaybackAdapterChanged() {
698692
}
699693

700694
private void onMaybeMuteChanged() {
701-
muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), player.isMuted() ? R.color.white : R.color.gray));
702-
703-
if (menu != null) {
695+
if (menu != null && player != null) {
704696
MenuItem item = menu.findItem(R.id.action_mute);
705697
TypedArray a = getTheme().obtainStyledAttributes(R.style.Theme_AppCompat, new int[]{R.attr.volume_off});
706698
int attributeResourceId = a.getResourceId(0, 0);
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
<vector android:height="24dp" android:tint="#515151"
2-
android:viewportHeight="24.0" android:viewportWidth="24.0"
3-
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4-
<path android:fillColor="@color/gray" android:pathData="M16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v2.21l2.45,2.45c0.03,-0.2 0.05,-0.41 0.05,-0.63zM19,12c0,0.94 -0.2,1.82 -0.54,2.64l1.51,1.51C20.63,14.91 21,13.5 21,12c0,-4.28 -2.99,-7.86 -7,-8.77v2.06c2.89,0.86 5,3.54 5,6.71zM4.27,3L3,4.27 7.73,9L3,9v6h4l5,5v-6.73l4.25,4.25c-0.67,0.52 -1.42,0.93 -2.25,1.18v2.06c1.38,-0.31 2.63,-0.95 3.69,-1.81L19.73,21 21,19.73l-9,-9L4.27,3zM12,4L9.91,6.09 12,8.18L12,4z"/>
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:tint="#4EFFFFFF"
5+
android:viewportWidth="24.0"
6+
android:viewportHeight="24.0">
7+
<path
8+
android:fillColor="@color/gray"
9+
android:pathData="M16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v2.21l2.45,2.45c0.03,-0.2 0.05,-0.41 0.05,-0.63zM19,12c0,0.94 -0.2,1.82 -0.54,2.64l1.51,1.51C20.63,14.91 21,13.5 21,12c0,-4.28 -2.99,-7.86 -7,-8.77v2.06c2.89,0.86 5,3.54 5,6.71zM4.27,3L3,4.27 7.73,9L3,9v6h4l5,5v-6.73l4.25,4.25c-0.67,0.52 -1.42,0.93 -2.25,1.18v2.06c1.38,-0.31 2.63,-0.95 3.69,-1.81L19.73,21 21,19.73l-9,-9L4.27,3zM12,4L9.91,6.09 12,8.18L12,4z" />
510
</vector>

app/src/main/res/layout-land/activity_player_queue_control.xml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
android:layout_marginLeft="5dp"
193193
android:layout_marginRight="5dp"
194194
android:layout_centerVertical="true"
195-
android:layout_toLeftOf="@+id/control_mute"
195+
android:layout_toLeftOf="@+id/control_repeat"
196196
android:gravity="center"
197197
android:minWidth="50dp"
198198
android:text="1x"
@@ -201,30 +201,13 @@
201201
android:background="?attr/selectableItemBackground"
202202
tools:ignore="HardcodedText,RtlHardcoded"/>
203203

204-
<ImageButton
205-
android:id="@+id/control_mute"
206-
android:layout_width="30dp"
207-
android:layout_height="30dp"
208-
android:layout_toLeftOf="@+id/control_repeat"
209-
android:layout_centerVertical="true"
210-
android:layout_marginLeft="5dp"
211-
android:layout_marginRight="5dp"
212-
android:background="?attr/selectableItemBackgroundBorderless"
213-
android:clickable="true"
214-
android:focusable="true"
215-
android:scaleType="fitXY"
216-
app:srcCompat="@drawable/ic_volume_off_white_72dp"
217-
android:tint="@color/gray"
218-
tools:ignore="ContentDescription"/>
219-
220204
<ImageButton
221205
android:id="@+id/control_repeat"
222206
android:layout_width="30dp"
223207
android:layout_height="30dp"
208+
android:layout_toLeftOf="@+id/anchor"
224209
android:layout_centerVertical="true"
225-
android:layout_centerInParent="true"
226210
android:layout_marginLeft="5dp"
227-
android:layout_marginRight="5dp"
228211
android:background="?attr/selectableItemBackgroundBorderless"
229212
android:clickable="true"
230213
android:focusable="true"
@@ -233,12 +216,16 @@
233216
android:src="@drawable/ic_repeat_white"
234217
tools:ignore="ContentDescription"/>
235218

219+
<View android:layout_width="10dp"
220+
android:layout_height="1dp"
221+
android:layout_centerInParent="true"
222+
android:id="@+id/anchor"/>
236223

237224
<ImageButton
238225
android:id="@+id/control_shuffle"
239226
android:layout_width="30dp"
240227
android:layout_height="30dp"
241-
android:layout_toRightOf="@+id/control_repeat"
228+
android:layout_toRightOf="@+id/anchor"
242229
android:layout_centerVertical="true"
243230
android:layout_marginRight="5dp"
244231
android:background="?attr/selectableItemBackgroundBorderless"

app/src/main/res/layout/activity_player_queue_control.xml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
android:layout_marginLeft="5dp"
177177
android:layout_marginRight="5dp"
178178
android:layout_centerVertical="true"
179-
android:layout_toLeftOf="@+id/control_mute"
179+
android:layout_toLeftOf="@+id/control_repeat"
180180
android:gravity="center"
181181
android:minWidth="50dp"
182182
android:text="1x"
@@ -185,22 +185,6 @@
185185
android:background="?attr/selectableItemBackground"
186186
tools:ignore="HardcodedText,RtlHardcoded"/>
187187

188-
<ImageButton
189-
android:id="@+id/control_mute"
190-
android:layout_width="30dp"
191-
android:layout_height="30dp"
192-
android:layout_toLeftOf="@+id/control_repeat"
193-
android:layout_centerVertical="true"
194-
android:layout_marginLeft="5dp"
195-
android:layout_marginRight="5dp"
196-
android:background="?attr/selectableItemBackgroundBorderless"
197-
android:clickable="true"
198-
android:focusable="true"
199-
android:scaleType="fitXY"
200-
app:srcCompat="@drawable/ic_volume_off_white_72dp"
201-
android:tint="@color/gray"
202-
tools:ignore="ContentDescription"/>
203-
204188
<ImageButton
205189
android:id="@+id/control_repeat"
206190
android:layout_width="30dp"

0 commit comments

Comments
 (0)