move transparency of shuffle mode off button to bitmap

PiperOrigin-RevId: 266795413
This commit is contained in:
bachinger 2019-09-02 18:05:18 +01:00 committed by Oliver Woodman
parent 525d0320a7
commit c879bbf64c
14 changed files with 36 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -0,0 +1,26 @@
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#4EFFFFFF"
android:pathData="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20
17.96 7.46 20 9.5V4h-5.5zm0.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04
2.04-3.13-3.13z" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

View File

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

View File

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

View File

Before

Width:  |  Height:  |  Size: 436 B

After

Width:  |  Height:  |  Size: 436 B

View File

@ -52,7 +52,7 @@
</style>
<style name="ExoMediaButton.Shuffle">
<item name="android:src">@drawable/exo_controls_shuffle</item>
<item name="android:src">@drawable/exo_controls_shuffle_off</item>
<item name="android:contentDescription">@string/exo_controls_shuffle_description</item>
</style>