From c879bbf64cb8ce186491b431f03e90cce3a425d0 Mon Sep 17 00:00:00 2001 From: bachinger Date: Mon, 2 Sep 2019 18:05:18 +0100 Subject: [PATCH] move transparency of shuffle mode off button to bitmap PiperOrigin-RevId: 266795413 --- .../exoplayer2/ui/PlayerControlView.java | 13 ++++++--- .../exo_controls_shuffle_off.xml | 26 ++++++++++++++++++ ...huffle.xml => exo_controls_shuffle_on.xml} | 0 .../exo_controls_shuffle_off.png | Bin 0 -> 265 bytes ...huffle.png => exo_controls_shuffle_on.png} | Bin .../exo_controls_shuffle_off.png | Bin 0 -> 182 bytes ...huffle.png => exo_controls_shuffle_on.png} | Bin .../exo_controls_shuffle_off.png | Bin 0 -> 228 bytes ...huffle.png => exo_controls_shuffle_on.png} | Bin .../exo_controls_shuffle_off.png | Bin 0 -> 342 bytes ...huffle.png => exo_controls_shuffle_on.png} | Bin .../exo_controls_shuffle_off.png | Bin 0 -> 438 bytes ...huffle.png => exo_controls_shuffle_on.png} | Bin library/ui/src/main/res/values/styles.xml | 2 +- 14 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle_off.xml rename library/ui/src/main/res/drawable-anydpi-v21/{exo_controls_shuffle.xml => exo_controls_shuffle_on.xml} (100%) create mode 100644 library/ui/src/main/res/drawable-hdpi/exo_controls_shuffle_off.png rename library/ui/src/main/res/drawable-hdpi/{exo_controls_shuffle.png => exo_controls_shuffle_on.png} (100%) create mode 100644 library/ui/src/main/res/drawable-ldpi/exo_controls_shuffle_off.png rename library/ui/src/main/res/drawable-ldpi/{exo_controls_shuffle.png => exo_controls_shuffle_on.png} (100%) create mode 100644 library/ui/src/main/res/drawable-mdpi/exo_controls_shuffle_off.png rename library/ui/src/main/res/drawable-mdpi/{exo_controls_shuffle.png => exo_controls_shuffle_on.png} (100%) create mode 100644 library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle_off.png rename library/ui/src/main/res/drawable-xhdpi/{exo_controls_shuffle.png => exo_controls_shuffle_on.png} (100%) create mode 100644 library/ui/src/main/res/drawable-xxhdpi/exo_controls_shuffle_off.png rename library/ui/src/main/res/drawable-xxhdpi/{exo_controls_shuffle.png => exo_controls_shuffle_on.png} (100%) diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java index 73bb98a1a0..e35169dd71 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java @@ -238,7 +238,7 @@ public class PlayerControlView extends FrameLayout { private final View fastForwardButton; private final View rewindButton; private final ImageView repeatToggleButton; - private final View shuffleButton; + private final ImageView shuffleButton; private final View vrButton; private final TextView durationView; private final TextView positionView; @@ -256,6 +256,8 @@ public class PlayerControlView extends FrameLayout { private final String repeatOffButtonContentDescription; private final String repeatOneButtonContentDescription; private final String repeatAllButtonContentDescription; + private final Drawable shuffleOnButtonDrawable; + private final Drawable shuffleOffButtonDrawable; @Nullable private Player player; private com.google.android.exoplayer2.ControlDispatcher controlDispatcher; @@ -407,6 +409,8 @@ public class PlayerControlView extends FrameLayout { repeatOffButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_off); repeatOneButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_one); repeatAllButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_all); + shuffleOnButtonDrawable = resources.getDrawable(R.drawable.exo_controls_shuffle_on); + shuffleOffButtonDrawable = resources.getDrawable(R.drawable.exo_controls_shuffle_off); repeatOffButtonContentDescription = resources.getString(R.string.exo_controls_repeat_off_description); repeatOneButtonContentDescription = @@ -815,10 +819,11 @@ public class PlayerControlView extends FrameLayout { shuffleButton.setVisibility(GONE); } else if (player == null) { setButtonEnabled(false, shuffleButton); + shuffleButton.setImageDrawable(shuffleOffButtonDrawable); } else { - shuffleButton.setAlpha(player.getShuffleModeEnabled() ? 1f : 0.3f); - shuffleButton.setEnabled(true); - shuffleButton.setVisibility(VISIBLE); + setButtonEnabled(true, shuffleButton); + shuffleButton.setImageDrawable( + player.getShuffleModeEnabled() ? shuffleOnButtonDrawable : shuffleOffButtonDrawable); } } diff --git a/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle_off.xml b/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle_off.xml new file mode 100644 index 0000000000..283ce30c3c --- /dev/null +++ b/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle_off.xml @@ -0,0 +1,26 @@ + + + + + diff --git a/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle.xml b/library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle_on.xml similarity index 100% rename from library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle.xml rename to library/ui/src/main/res/drawable-anydpi-v21/exo_controls_shuffle_on.xml diff --git a/library/ui/src/main/res/drawable-hdpi/exo_controls_shuffle_off.png b/library/ui/src/main/res/drawable-hdpi/exo_controls_shuffle_off.png new file mode 100644 index 0000000000000000000000000000000000000000..b693422db75eeef7c4beded7dbe9644eec85194a GIT binary patch literal 265 zcmV+k0rvihP)|OH=gIq{2%7koSSbot2;Bl*Z~rsziFwQQA0p}?-;bZ zA$d>OouIrYwyU7LBR<=|u)HG-;CVvud^j-CJO!?Lkvsv6n0USp%K gy{w(*k4Ut36#DLn;`P78pse{J9Po?zX{o-TQ{ZXM3MDneg;gita;L_f`?^_1 zl0MUbyBlW$9RnGj!Vh4CdW#`zCpT cnglDurOSd!uTxH$0iDg@>FVdQ&MBb@03C8#m;e9( literal 0 HcmV?d00001 diff --git a/library/ui/src/main/res/drawable-mdpi/exo_controls_shuffle.png b/library/ui/src/main/res/drawable-mdpi/exo_controls_shuffle_on.png similarity index 100% rename from library/ui/src/main/res/drawable-mdpi/exo_controls_shuffle.png rename to library/ui/src/main/res/drawable-mdpi/exo_controls_shuffle_on.png diff --git a/library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle_off.png b/library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle_off.png new file mode 100644 index 0000000000000000000000000000000000000000..2b67cabf5afabec4433cb71905087d42cc094b89 GIT binary patch literal 342 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I0wfs{c7`%AFv@zmIEGX(zP-`Nb|^uj^TTd7ZCALw$Y0r&=p1Lj{YUe@tcqam3F*7V$q%g~zq$ zeqNj>wf&6!pX1j{=FJoT_W#WMlIPD^eY0-b{9hz|?fXTsbN|)Wd}85v(sM?NtyIO*{-%sBUL`7Ldk h!^?}awnnY}#`f#r3*~;M_+_B*@^tlcS?83{1OVHAnMMEr literal 0 HcmV?d00001 diff --git a/library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle.png b/library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle_on.png similarity index 100% rename from library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle.png rename to library/ui/src/main/res/drawable-xhdpi/exo_controls_shuffle_on.png diff --git a/library/ui/src/main/res/drawable-xxhdpi/exo_controls_shuffle_off.png b/library/ui/src/main/res/drawable-xxhdpi/exo_controls_shuffle_off.png new file mode 100644 index 0000000000000000000000000000000000000000..22209d1f88712f3b615018fb1e7cfe572bdf256c GIT binary patch literal 438 zcmV;n0ZIOeP)A95OS2(`R-JKs2G;M#V*4;bHWx~}WGuIsw4 z>;9VVwAF*pWZGz)`kI&jrlF6^6K3X*1YvG|fG{;bK;Qtq`mz9l1N5vzkiY>E0ssUE zTI+xT0fO`Q8XOQJIG+Oo1m|-AC-8g@-~^tJ0f4~s_j=Nn0ssN$uaEEDng9TRfbx$s z0RRAj<(ptYfWY!iFd#ty`6eI$Agoxv2><{H8=h~1Pv;($!Pf3`RvnSWluE|5PJu+n=jp94&Y