From 47c5008871538f1cc1f14472b506f92e21f51d70 Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 21 Mar 2020 16:58:53 +0100 Subject: [PATCH 1/4] Change mute button color for more visibility --- .../main/java/org/schabi/newpipe/player/MainVideoPlayer.java | 2 +- app/src/main/res/layout-large-land/activity_main_player.xml | 3 +-- app/src/main/res/layout/activity_main_player.xml | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 51dff970f..b5e614bec 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -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)); } diff --git a/app/src/main/res/layout-large-land/activity_main_player.xml b/app/src/main/res/layout-large-land/activity_main_player.xml index 364790071..1499eec36 100644 --- a/app/src/main/res/layout-large-land/activity_main_player.xml +++ b/app/src/main/res/layout-large-land/activity_main_player.xml @@ -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" /> + tools:ignore="RtlHardcoded" /> From c54ac32732b7e253610770069bb722d7156fd4a4 Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 21 Mar 2020 21:42:11 +0100 Subject: [PATCH 2/4] mute button color for queue --- .../newpipe/player/ServicePlayerActivity.java | 13 ++++++++----- .../main/res/drawable/ic_volume_up_black_24dp.xml | 9 +++++++++ .../main/res/drawable/ic_volume_up_white_24dp.xml | 9 +++++++++ app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/styles.xml | 2 ++ 5 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 app/src/main/res/drawable/ic_volume_up_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_volume_up_white_24dp.xml 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 e7700351e..f0223f8ce 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -4,6 +4,7 @@ import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.content.res.TypedArray; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.IBinder; @@ -700,11 +701,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)); + } } diff --git a/app/src/main/res/drawable/ic_volume_up_black_24dp.xml b/app/src/main/res/drawable/ic_volume_up_black_24dp.xml new file mode 100644 index 000000000..bb0c74ba1 --- /dev/null +++ b/app/src/main/res/drawable/ic_volume_up_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_volume_up_white_24dp.xml b/app/src/main/res/drawable/ic_volume_up_white_24dp.xml new file mode 100644 index 000000000..f63b9e451 --- /dev/null +++ b/app/src/main/res/drawable/ic_volume_up_white_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 4cda52a99..39a51f234 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -16,6 +16,7 @@ + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f7d09ef9c..9a41752b1 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -33,6 +33,7 @@ @drawable/ic_expand_more_black_24dp @drawable/ic_expand_less_black_24dp @drawable/ic_volume_off_black_24dp + @drawable/ic_volume_up_black_24dp @drawable/ic_palette_black_24dp @drawable/ic_language_black_24dp @drawable/ic_history_black_24dp @@ -139,6 +140,7 @@ @drawable/ic_expand_more_white_24dp @drawable/ic_expand_less_white_24dp @drawable/ic_volume_off_white_24dp + @drawable/ic_volume_up_white_24dp @drawable/ic_palette_white_24dp @drawable/ic_language_white_24dp @drawable/ic_history_white_24dp From 8d068b339ab44881e95b485c4079e9e3ca9c2ab7 Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 21 Mar 2020 21:54:40 +0100 Subject: [PATCH 3/4] remove unused imports --- .../java/org/schabi/newpipe/player/ServicePlayerActivity.java | 3 --- 1 file changed, 3 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 f0223f8ce..113592b47 100644 --- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java +++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java @@ -3,15 +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.Color; 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; From bb91b168635208e0b91e78a0cf15f1b521b0938a Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 21 Mar 2020 22:07:39 +0100 Subject: [PATCH 4/4] use 8F instead of 6f for white hexadecimal, on @wb9688 advise --- app/src/main/res/drawable/ic_volume_up_white_24dp.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/drawable/ic_volume_up_white_24dp.xml b/app/src/main/res/drawable/ic_volume_up_white_24dp.xml index f63b9e451..271540946 100644 --- a/app/src/main/res/drawable/ic_volume_up_white_24dp.xml +++ b/app/src/main/res/drawable/ic_volume_up_white_24dp.xml @@ -4,6 +4,6 @@ android:viewportWidth="24.0" android:viewportHeight="24.0">