From bf78cbb63e1faa2707d13b217dd0d2c2bf9ffcf8 Mon Sep 17 00:00:00 2001 From: polymorphicshade Date: Wed, 19 Aug 2020 09:36:23 -0600 Subject: [PATCH] SponsorBlock: Improved enable/disable icons Re-did the enable/disable icons to be cleaner and their behavior more understandable (w/ toast). Made icons more consistent with others (black, white, actually 24dp). --- .../newpipe/player/VideoPlayerImpl.java | 12 ++++++++++-- .../ic_sponsor_block_disable_black_24dp.xml | 18 ++++++++++++++++++ .../ic_sponsor_block_disable_white_24dp.xml | 19 +++++++++++++++++++ .../ic_sponsor_block_enable_black_24dp.xml | 12 ++++++++++++ .../ic_sponsor_block_enable_white_24dp.xml | 13 +++++++++++++ .../ic_sponsorblock_disable_white_24dp.xml | 6 ------ .../ic_sponsorblock_enable_white_24dp.xml | 6 ------ app/src/main/res/layout/player.xml | 2 +- app/src/main/res/values/attrs.xml | 2 ++ app/src/main/res/values/styles.xml | 4 ++++ 10 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 app/src/main/res/drawable/ic_sponsor_block_disable_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_sponsor_block_disable_white_24dp.xml create mode 100644 app/src/main/res/drawable/ic_sponsor_block_enable_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_sponsor_block_enable_white_24dp.xml delete mode 100644 app/src/main/res/drawable/ic_sponsorblock_disable_white_24dp.xml delete mode 100644 app/src/main/res/drawable/ic_sponsorblock_enable_white_24dp.xml diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java index baaba15fe..b833c7788 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java @@ -56,6 +56,8 @@ import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.SeekBar; import android.widget.TextView; +import android.widget.Toast; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -646,6 +648,12 @@ public class VideoPlayerImpl extends VideoPlayer public void onBlockingSponsorsButtonClicked() { super.onBlockingSponsorsButtonClicked(); setBlockSponsorsButton(blockSponsorsButton, isBlockingSponsors()); + + Toast.makeText(context, + isBlockingSponsors() + ? "SponsorBlock enabled" + : "SponsorBlock disabled", + Toast.LENGTH_SHORT).show(); } @Override @@ -1591,8 +1599,8 @@ public class VideoPlayerImpl extends VideoPlayer protected void setBlockSponsorsButton(final ImageButton button, final boolean isBlockingSponsors) { button.setImageDrawable(AppCompatResources.getDrawable(service, isBlockingSponsors - ? R.drawable.ic_sponsorblock_disable_white_24dp - : R.drawable.ic_sponsorblock_enable_white_24dp)); + ? R.drawable.ic_sponsor_block_enable_white_24dp + : R.drawable.ic_sponsor_block_disable_white_24dp)); } /** diff --git a/app/src/main/res/drawable/ic_sponsor_block_disable_black_24dp.xml b/app/src/main/res/drawable/ic_sponsor_block_disable_black_24dp.xml new file mode 100644 index 000000000..dcadfeb66 --- /dev/null +++ b/app/src/main/res/drawable/ic_sponsor_block_disable_black_24dp.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_sponsor_block_disable_white_24dp.xml b/app/src/main/res/drawable/ic_sponsor_block_disable_white_24dp.xml new file mode 100644 index 000000000..6cc8cd3b4 --- /dev/null +++ b/app/src/main/res/drawable/ic_sponsor_block_disable_white_24dp.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_sponsor_block_enable_black_24dp.xml b/app/src/main/res/drawable/ic_sponsor_block_enable_black_24dp.xml new file mode 100644 index 000000000..f5abd06ac --- /dev/null +++ b/app/src/main/res/drawable/ic_sponsor_block_enable_black_24dp.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_sponsor_block_enable_white_24dp.xml b/app/src/main/res/drawable/ic_sponsor_block_enable_white_24dp.xml new file mode 100644 index 000000000..2bda0ba7b --- /dev/null +++ b/app/src/main/res/drawable/ic_sponsor_block_enable_white_24dp.xml @@ -0,0 +1,13 @@ + + + + diff --git a/app/src/main/res/drawable/ic_sponsorblock_disable_white_24dp.xml b/app/src/main/res/drawable/ic_sponsorblock_disable_white_24dp.xml deleted file mode 100644 index 2d7730aaa..000000000 --- a/app/src/main/res/drawable/ic_sponsorblock_disable_white_24dp.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_sponsorblock_enable_white_24dp.xml b/app/src/main/res/drawable/ic_sponsorblock_enable_white_24dp.xml deleted file mode 100644 index 58448ed0c..000000000 --- a/app/src/main/res/drawable/ic_sponsorblock_enable_white_24dp.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/app/src/main/res/layout/player.xml b/app/src/main/res/layout/player.xml index 4858161dc..571a2fca9 100644 --- a/app/src/main/res/layout/player.xml +++ b/app/src/main/res/layout/player.xml @@ -315,7 +315,7 @@ android:clickable="true" android:focusable="true" android:scaleType="fitXY" - app:srcCompat="@drawable/ic_sponsorblock_disable_white_24dp" + app:srcCompat="@drawable/ic_sponsor_block_disable_white_24dp" android:background="?attr/selectableItemBackground" android:contentDescription="@string/sponsorblock_toggle_skipping" tools:ignore="RtlHardcoded" /> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index cbf538fb5..a22ee1814 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -82,6 +82,8 @@ + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 9a81d01e1..b8b6864fb 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -97,6 +97,8 @@ @drawable/ic_sort_black_24dp @drawable/ic_help_black_24dp @drawable/ic_arrow_back_black_24dp + @drawable/ic_sponsor_block_enable_black_24dp + @drawable/ic_sponsor_block_disable_black_24dp @color/light_separator_color @color/light_contrast_background_color @@ -204,6 +206,8 @@ @drawable/ic_sort_white_24dp @drawable/ic_help_white_24dp @drawable/ic_arrow_back_white_24dp + @drawable/ic_sponsor_block_enable_white_24dp + @drawable/ic_sponsor_block_disable_white_24dp @color/dark_separator_color @color/dark_contrast_background_color