*** Original commit ***

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: 343531411
This commit is contained in:
olly 2020-11-20 19:32:32 +00:00 committed by Ian Baker
parent a987e106e6
commit b16cf5941e
8 changed files with 49 additions and 23 deletions

View File

@ -48,7 +48,6 @@
`LeanbackPlayerAdapter` and use `ControlDispatcher` for dispatching
prepare instead
([#7882](https://github.com/google/ExoPlayer/issues/7882)).
* Switch `StyledPlayerControlView` button controls to borderless ripples.
* Add `bar_gravity` attribute into `DefaultTimeBar`.
* Increase seekbar's touch target height in `StyledPlayerControlView`.
* Update Styled Player settings dialogs to respect RTL.

View File

@ -14,7 +14,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Borderless is not available before v21 -->
<item android:drawable="?android:attr/selectableItemBackground" />
</layer-list>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/exo_gray">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/exo_white" />
</shape>
</item>
<item android:id="@android:id/background"
android:drawable="@drawable/exo_styled_controls_fastforward" />
</ripple>

View File

@ -14,7 +14,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Borderless is not available before v21 -->
<item android:drawable="?android:attr/selectableItemBackgroundBorderless" />
</layer-list>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/exo_gray">
<item android:id="@android:id/mask">
<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>

View File

@ -14,8 +14,16 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/exo_selectable_item_background_borderless" />
<item android:id="@android:id/background"
android:drawable="@drawable/exo_styled_controls_fastforward" />
</layer-list>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list>
<item>
<shape>
<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>

View File

@ -14,8 +14,16 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/exo_selectable_item_background_borderless" />
<item android:id="@android:id/background"
android:drawable="@drawable/exo_styled_controls_rewind" />
</layer-list>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list>
<item>
<shape>
<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>

View File

@ -16,10 +16,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="24dp"
android:gravity="center"
android:orientation="horizontal"
android:background="@android:color/transparent"
android:visibility="visible">
<ImageButton android:id="@+id/exo_prev"

View File

@ -15,6 +15,8 @@
limitations under the License.
-->
<resources>
<color name="exo_gray">#808080</color>
<color name="exo_gray_ripple">#80808080</color>
<color name="exo_white">#ffffff</color>
<color name="exo_white_opacity_70">#B3ffffff</color>
<color name="exo_black_opacity_70">#B3000000</color>

View File

@ -59,7 +59,7 @@
<style name="ExoStyledControls"/>
<style name="ExoStyledControls.Button">
<item name="android:background">@drawable/exo_selectable_item_background_borderless</item>
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="android:scaleType">fitXY</item>
<item name="android:layout_marginLeft">@dimen/exo_icon_horizontal_margin</item>
<item name="android:layout_marginRight">@dimen/exo_icon_horizontal_margin</item>
@ -141,7 +141,6 @@
</style>
<style name="ExoStyledControls.Button.Bottom">
<item name="android:background">?android:attr/selectableItemBackground</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:layout_width">@dimen/exo_small_icon_width</item>
<item name="android:layout_height">@dimen/exo_small_icon_height</item>