Commit e4eb6b7e by bachinger Committed by Toni

move transparency values of buttons to resources to make it accessible for customization

PiperOrigin-RevId: 266880069
parent 64829a03
...@@ -258,6 +258,8 @@ public class PlayerControlView extends FrameLayout { ...@@ -258,6 +258,8 @@ public class PlayerControlView extends FrameLayout {
private final String repeatAllButtonContentDescription; private final String repeatAllButtonContentDescription;
private final Drawable shuffleOnButtonDrawable; private final Drawable shuffleOnButtonDrawable;
private final Drawable shuffleOffButtonDrawable; private final Drawable shuffleOffButtonDrawable;
private final float buttonAlphaEnabled;
private final float buttonAlphaDisabled;
@Nullable private Player player; @Nullable private Player player;
private com.google.android.exoplayer2.ControlDispatcher controlDispatcher; private com.google.android.exoplayer2.ControlDispatcher controlDispatcher;
...@@ -405,7 +407,14 @@ public class PlayerControlView extends FrameLayout { ...@@ -405,7 +407,14 @@ public class PlayerControlView extends FrameLayout {
} }
vrButton = findViewById(R.id.exo_vr); vrButton = findViewById(R.id.exo_vr);
setShowVrButton(false); setShowVrButton(false);
Resources resources = context.getResources(); Resources resources = context.getResources();
buttonAlphaEnabled =
(float) resources.getInteger(R.integer.exo_media_button_opacity_percentage_enabled) / 100;
buttonAlphaDisabled =
(float) resources.getInteger(R.integer.exo_media_button_opacity_percentage_disabled) / 100;
repeatOffButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_off); repeatOffButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_off);
repeatOneButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_one); repeatOneButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_one);
repeatAllButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_all); repeatAllButtonDrawable = resources.getDrawable(R.drawable.exo_controls_repeat_all);
...@@ -959,7 +968,7 @@ public class PlayerControlView extends FrameLayout { ...@@ -959,7 +968,7 @@ public class PlayerControlView extends FrameLayout {
return; return;
} }
view.setEnabled(enabled); view.setEnabled(enabled);
view.setAlpha(enabled ? 1f : 0.3f); view.setAlpha(enabled ? buttonAlphaEnabled : buttonAlphaDisabled);
view.setVisibility(VISIBLE); view.setVisibility(VISIBLE);
} }
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
<dimen name="exo_media_button_width">71dp</dimen> <dimen name="exo_media_button_width">71dp</dimen>
<dimen name="exo_media_button_height">52dp</dimen> <dimen name="exo_media_button_height">52dp</dimen>
<integer name="exo_media_button_opacity_percentage_enabled">100</integer>
<integer name="exo_media_button_opacity_percentage_disabled">33</integer>
<color name="exo_error_message_background_color">#AA000000</color> <color name="exo_error_message_background_color">#AA000000</color>
<color name="exo_edit_mode_background_color">#FFF4F3F0</color> <color name="exo_edit_mode_background_color">#FFF4F3F0</color>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment