Commit eded1ca1 by olly Committed by Ian Baker

Update Styled non bottom buttons to be borderless.

This requires the parent of the background to draw and have padding large enough to support the size of the ripple.

The bottom buttons must remained bordered as the space around them is constrained.

PiperOrigin-RevId: 350590722
parent 1057f2e4
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
* Add `LiveConfiguration` to `MediaItem` to allow media-specific live * Add `LiveConfiguration` to `MediaItem` to allow media-specific live
offset and live playback speed settings. The same settings can be set offset and live playback speed settings. The same settings can be set
for all `MediaItems` in `DefaultMediaSourceFactory`. for all `MediaItems` in `DefaultMediaSourceFactory`.
* Add `targetLiveOffsetUs` parameter to * Add `targetLiveOffsetUs` parameter to `LoadControl.shouldStartPlayback`.
`LoadControl.shouldStartPlayback`.
* Verify correct thread usage in `SimpleExoPlayer` by default. Opt-out is * Verify correct thread usage in `SimpleExoPlayer` by default. Opt-out is
still possible until the next major release using still possible until the next major release using
`setThrowsWhenUsingWrongThread(false)` `setThrowsWhenUsingWrongThread(false)`
...@@ -71,6 +70,7 @@ ...@@ -71,6 +70,7 @@
enough space. enough space.
* Update StyledPlayer's control overlay scrim from 30% opacity to 60% * Update StyledPlayer's control overlay scrim from 30% opacity to 60%
opacity for Accessibility requirements. opacity for Accessibility requirements.
* Switch `StyledPlayerControlView` button controls to borderless ripples.
* DRM: * DRM:
* Fix playback failure when switching from PlayReady protected content to * Fix playback failure when switching from PlayReady protected content to
Widevine or Clearkey protected content in a playlist. Widevine or Clearkey protected content in a playlist.
......
...@@ -571,9 +571,16 @@ import java.util.List; ...@@ -571,9 +571,16 @@ import java.util.List;
styledPlayerControlView.getHeight() styledPlayerControlView.getHeight()
- styledPlayerControlView.getPaddingBottom() - styledPlayerControlView.getPaddingBottom()
- styledPlayerControlView.getPaddingTop(); - styledPlayerControlView.getPaddingTop();
int centerControlWidth =
getWidthWithMargins(centerControls)
- (centerControls != null
? (centerControls.getPaddingLeft() + centerControls.getPaddingRight())
: 0);
int defaultModeMinimumWidth = int defaultModeMinimumWidth =
Math.max( Math.max(
getWidthWithMargins(centerControls), centerControlWidth,
getWidthWithMargins(timeView) + getWidthWithMargins(overflowShowButton)); getWidthWithMargins(timeView) + getWidthWithMargins(overflowShowButton));
int defaultModeMinimumHeight = int defaultModeMinimumHeight =
getHeightWithMargins(centerControls) + 2 * getHeightWithMargins(bottomBar); getHeightWithMargins(centerControls) + 2 * getHeightWithMargins(bottomBar);
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!-- Copyright 2020 The Android Open Source Project
Copyright 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
...@@ -14,16 +13,8 @@ ...@@ -14,16 +13,8 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list> <Button android:id="@+id/exo_ffwd_with_amount"
<item> style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/>
<shape> </merge>
<solid android:color="@color/exo_gray_ripple"/>
</shape>
</item>
<item android:drawable="@drawable/exo_styled_controls_fastforward"/>
</layer-list>
</item>
<item android:drawable="@drawable/exo_styled_controls_fastforward" />
</selector>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!-- Copyright 2020 The Android Open Source Project
Copyright 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
...@@ -14,16 +13,8 @@ ...@@ -14,16 +13,8 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list> <Button android:id="@+id/exo_rew_with_amount"
<item> style="@style/ExoStyledControls.Button.Center.RewWithAmount"/>
<shape> </merge>
<solid android:color="@color/exo_gray_ripple"/>
</shape>
</item>
<item android:drawable="@drawable/exo_styled_controls_rewind"/>
</layer-list>
</item>
<item android:drawable="@drawable/exo_styled_controls_rewind" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:addStatesFromChildren="true"
style="@style/ExoStyledControls.Button.Center">
<!-- View's don't have foreground until API 23 so we have to nest in a parent. -->
<Button android:id="@+id/exo_ffwd_with_amount"
android:background="@drawable/exo_styled_controls_fastforward"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/>
</FrameLayout>
</merge>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:addStatesFromChildren="true"
style="@style/ExoStyledControls.Button.Center">
<!-- View's don't have foreground until API 23 so we have to nest in a parent. -->
<Button android:id="@+id/exo_rew_with_amount"
android:background="@drawable/exo_styled_controls_rewind"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
style="@style/ExoStyledControls.Button.Center.RewWithAmount"/>
</FrameLayout>
</merge>
...@@ -119,23 +119,25 @@ ...@@ -119,23 +119,25 @@
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/exo_center_controls" <LinearLayout
android:id="@+id/exo_center_controls"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center"> android:background="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/exo_styled_controls_padding">
<ImageButton android:id="@+id/exo_prev" <ImageButton android:id="@+id/exo_prev"
style="@style/ExoStyledControls.Button.Center.Previous"/> style="@style/ExoStyledControls.Button.Center.Previous"/>
<Button android:id="@+id/exo_rew_with_amount" <include layout="@layout/exo_styled_player_control_rewind_button" />
style="@style/ExoStyledControls.Button.Center.RewWithAmount"/>
<ImageButton android:id="@+id/exo_play_pause" <ImageButton android:id="@+id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause"/> style="@style/ExoStyledControls.Button.Center.PlayPause"/>
<Button android:id="@+id/exo_ffwd_with_amount" <include layout="@layout/exo_styled_player_control_ffwd_button" />
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/>
<ImageButton android:id="@+id/exo_next" <ImageButton android:id="@+id/exo_next"
style="@style/ExoStyledControls.Button.Center.Next"/> style="@style/ExoStyledControls.Button.Center.Next"/>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!-- Copyright (C) 2016 The Android Open Source Project
Copyright 2020 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
...@@ -14,13 +13,6 @@ ...@@ -14,13 +13,6 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android" <resources>
android:color="@color/exo_gray"> <dimen name="exo_styled_controls_padding">24dp</dimen>
<item android:id="@android:id/mask"> </resources>
<shape android:shape="rectangle">
<solid android:color="@color/exo_white" />
</shape>
</item>
<item android:id="@android:id/background"
android:drawable="@drawable/exo_styled_controls_rewind" />
</ripple>
...@@ -14,13 +14,10 @@ ...@@ -14,13 +14,10 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android" <resources>
android:color="@color/exo_gray"> <style name="ExoStyledControls.Button.Center">
<item android:id="@android:id/mask"> <item name="android:layout_width">@dimen/exo_icon_size</item>
<shape android:shape="rectangle"> <item name="android:layout_height">@dimen/exo_icon_size</item>
<solid android:color="@color/exo_white" /> <item name="android:background">?android:attr/selectableItemBackgroundBorderless</item>
</shape> </style>
</item> </resources>
<item android:id="@android:id/background"
android:drawable="@drawable/exo_styled_controls_fastforward" />
</ripple>
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
limitations under the License. limitations under the License.
--> -->
<resources> <resources>
<color name="exo_gray">#808080</color>
<color name="exo_gray_ripple">#80808080</color>
<color name="exo_white">#ffffff</color> <color name="exo_white">#ffffff</color>
<color name="exo_white_opacity_70">#B3ffffff</color> <color name="exo_white_opacity_70">#B3ffffff</color>
<color name="exo_black_opacity_70">#B3000000</color> <color name="exo_black_opacity_70">#B3000000</color>
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<dimen name="exo_styled_bottom_bar_height">60dp</dimen> <dimen name="exo_styled_bottom_bar_height">60dp</dimen>
<dimen name="exo_styled_bottom_bar_time_padding">10dp</dimen> <dimen name="exo_styled_bottom_bar_time_padding">10dp</dimen>
<dimen name="exo_styled_bottom_bar_margin_top">10dp</dimen> <dimen name="exo_styled_bottom_bar_margin_top">10dp</dimen>
<dimen name="exo_styled_controls_padding">0dp</dimen>
<dimen name="exo_styled_minimal_controls_margin_bottom">4dp</dimen> <dimen name="exo_styled_minimal_controls_margin_bottom">4dp</dimen>
<dimen name="exo_error_message_height">32dp</dimen> <dimen name="exo_error_message_height">32dp</dimen>
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</style> </style>
<style name="ExoStyledControls.Button.Center.FfwdWithAmount"> <style name="ExoStyledControls.Button.Center.FfwdWithAmount">
<item name="android:background">@drawable/exo_ripple_ffwd</item> <item name="android:foreground">@drawable/exo_styled_controls_fastforward</item>
<item name="android:gravity">center|bottom</item> <item name="android:gravity">center|bottom</item>
<item name="android:paddingBottom">@dimen/exo_icon_padding_bottom</item> <item name="android:paddingBottom">@dimen/exo_icon_padding_bottom</item>
<item name="android:textAppearance">@style/ExoStyledControls.ButtonText</item> <item name="android:textAppearance">@style/ExoStyledControls.ButtonText</item>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
</style> </style>
<style name="ExoStyledControls.Button.Center.RewWithAmount"> <style name="ExoStyledControls.Button.Center.RewWithAmount">
<item name="android:background">@drawable/exo_ripple_rew</item> <item name="android:foreground">@drawable/exo_styled_controls_rewind</item>
<item name="android:gravity">center|bottom</item> <item name="android:gravity">center|bottom</item>
<item name="android:paddingBottom">@dimen/exo_icon_padding_bottom</item> <item name="android:paddingBottom">@dimen/exo_icon_padding_bottom</item>
<item name="android:textAppearance">@style/ExoStyledControls.ButtonText</item> <item name="android:textAppearance">@style/ExoStyledControls.ButtonText</item>
......
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