mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 16:40:32 +00:00
Merge pull request #3252 from B0pol/mute_button
Change mute button color for more visibility
This commit is contained in:
commit
5a8b565199
@ -403,7 +403,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
||||
}
|
||||
|
||||
protected void setMuteButton(final ImageButton muteButton, final boolean isMuted) {
|
||||
muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), isMuted ? R.color.white : R.color.gray));
|
||||
muteButton.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), isMuted ? R.drawable.ic_volume_off_white_72dp : R.drawable.ic_volume_up_white_72dp));
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,14 +3,12 @@ package org.schabi.newpipe.player;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
@ -700,11 +698,13 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
||||
item.setTitle(player.isMuted() ? R.string.unmute : R.string.mute);
|
||||
|
||||
//2) Icon change accordingly to current App Theme
|
||||
TypedArray a = getTheme().obtainStyledAttributes(R.style.Theme_AppCompat, new int[]{R.attr.volume_off});
|
||||
int attributeResourceId = a.getResourceId(0, 0);
|
||||
Drawable drawableMuted = getResources().getDrawable(attributeResourceId);
|
||||
Drawable drawableUnmuted = getResources().getDrawable(R.drawable.ic_volume_off_gray_24dp);
|
||||
item.setIcon(player.isMuted() ? drawableMuted : drawableUnmuted);
|
||||
item.setIcon(player.isMuted() ? getThemedDrawable(R.attr.volume_off) : getThemedDrawable(R.attr.volume_on));
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getThemedDrawable(int attribute) {
|
||||
return getResources().getDrawable(
|
||||
getTheme().obtainStyledAttributes(R.style.Theme_AppCompat, new int[]{attribute})
|
||||
.getResourceId(0, 0));
|
||||
}
|
||||
}
|
||||
|
9
app/src/main/res/drawable/ic_volume_up_black_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_volume_up_black_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_volume_up_white_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_volume_up_white_24dp.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/>
|
||||
</vector>
|
@ -405,8 +405,7 @@
|
||||
android:src="@drawable/ic_volume_off_white_24dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/switch_to_background"
|
||||
tools:ignore="RtlHardcoded"
|
||||
android:tint="@color/gray"/>
|
||||
tools:ignore="RtlHardcoded" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -403,8 +403,7 @@
|
||||
app:srcCompat="@drawable/ic_volume_off_white_72dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:contentDescription="@string/switch_to_background"
|
||||
tools:ignore="RtlHardcoded"
|
||||
android:tint="@color/gray"/>
|
||||
tools:ignore="RtlHardcoded" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
<attr name="expand" format="reference"/>
|
||||
<attr name="collapse" format="reference"/>
|
||||
<attr name="volume_off" format="reference"/>
|
||||
<attr name="volume_on" format="reference"/>
|
||||
<attr name="clear_history" format="reference" />
|
||||
<attr name="palette" format="reference"/>
|
||||
<attr name="language" format="reference"/>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<item name="expand">@drawable/ic_expand_more_black_24dp</item>
|
||||
<item name="collapse">@drawable/ic_expand_less_black_24dp</item>
|
||||
<item name="volume_off">@drawable/ic_volume_off_black_24dp</item>
|
||||
<item name="volume_on">@drawable/ic_volume_up_black_24dp</item>
|
||||
<item name="palette">@drawable/ic_palette_black_24dp</item>
|
||||
<item name="language">@drawable/ic_language_black_24dp</item>
|
||||
<item name="history">@drawable/ic_history_black_24dp</item>
|
||||
@ -139,6 +140,7 @@
|
||||
<item name="expand">@drawable/ic_expand_more_white_24dp</item>
|
||||
<item name="collapse">@drawable/ic_expand_less_white_24dp</item>
|
||||
<item name="volume_off">@drawable/ic_volume_off_white_24dp</item>
|
||||
<item name="volume_on">@drawable/ic_volume_up_white_24dp</item>
|
||||
<item name="palette">@drawable/ic_palette_white_24dp</item>
|
||||
<item name="language">@drawable/ic_language_white_24dp</item>
|
||||
<item name="history">@drawable/ic_history_white_24dp</item>
|
||||
|
Loading…
Reference in New Issue
Block a user