Workaround layout problems with Material Design

In some contexts (e.g. BottomSheetDialogFrament), Material Design
themes will override the default of singleLine=false to true. This
causes layout problems because the forward/rewind buttons are no
longer visible with singleLine=true.

This problem can be avoided by explicitly requesting the default
value of false in our layout files.

Issue: androidx/media#511

#minor-release

PiperOrigin-RevId: 582604131
This commit is contained in:
tonihei 2023-11-15 02:54:31 -08:00 committed by Copybara-Service
parent bd7615c0b8
commit 310e2edcca
5 changed files with 19 additions and 0 deletions

View File

@ -55,6 +55,9 @@
`MediaMetadata.extras` `MediaMetadata.extras`
([#756](https://github.com/androidx/media/issues/756)). ([#756](https://github.com/androidx/media/issues/756)).
* UI: * UI:
* Fix issue where forward and rewind buttons are not visible when used
with Material Design in a BottomSheetDialogFragment
([#511](https://github.com/androidx/media/issues/511)).
* Downloads: * Downloads:
* OkHttp Extension: * OkHttp Extension:
* Cronet Extension: * Cronet Extension:

View File

@ -15,6 +15,10 @@
--> -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Override of singleLine needed to avoid layout bugs with Material Design.
See https://github.com/androidx/media/issues/511.
-->
<Button android:id="@+id/exo_ffwd_with_amount" <Button android:id="@+id/exo_ffwd_with_amount"
android:singleLine="false"
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/> style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/>
</merge> </merge>

View File

@ -15,6 +15,10 @@
--> -->
<merge xmlns:android="http://schemas.android.com/apk/res/android"> <merge xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Override of singleLine needed to avoid layout bugs with Material Design.
See https://github.com/androidx/media/issues/511.
-->
<Button android:id="@+id/exo_rew_with_amount" <Button android:id="@+id/exo_rew_with_amount"
android:singleLine="false"
style="@style/ExoStyledControls.Button.Center.RewWithAmount"/> style="@style/ExoStyledControls.Button.Center.RewWithAmount"/>
</merge> </merge>

View File

@ -22,10 +22,14 @@
android:addStatesFromChildren="true" android:addStatesFromChildren="true"
style="@style/ExoStyledControls.Button.Center"> style="@style/ExoStyledControls.Button.Center">
<!-- View's don't have foreground until API 23 so we have to nest in a parent. --> <!-- View's don't have foreground until API 23 so we have to nest in a parent. -->
<!-- Override of singleLine needed to avoid layout bugs with Material Design.
See https://github.com/androidx/media/issues/511.
-->
<Button android:id="@id/exo_ffwd_with_amount" <Button android:id="@id/exo_ffwd_with_amount"
android:background="@drawable/exo_styled_controls_fastforward" android:background="@drawable/exo_styled_controls_fastforward"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:singleLine="false"
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/> style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"/>
</FrameLayout> </FrameLayout>

View File

@ -22,10 +22,14 @@
android:addStatesFromChildren="true" android:addStatesFromChildren="true"
style="@style/ExoStyledControls.Button.Center"> style="@style/ExoStyledControls.Button.Center">
<!-- View's don't have foreground until API 23 so we have to nest in a parent. --> <!-- View's don't have foreground until API 23 so we have to nest in a parent. -->
<!-- Override of singleLine needed to avoid layout bugs with Material Design.
See https://github.com/androidx/media/issues/511.
-->
<Button android:id="@id/exo_rew_with_amount" <Button android:id="@id/exo_rew_with_amount"
android:background="@drawable/exo_styled_controls_rewind" android:background="@drawable/exo_styled_controls_rewind"
android:layout_marginLeft="0dp" android:layout_marginLeft="0dp"
android:layout_marginRight="0dp" android:layout_marginRight="0dp"
android:singleLine="false"
style="@style/ExoStyledControls.Button.Center.RewWithAmount"/> style="@style/ExoStyledControls.Button.Center.RewWithAmount"/>
</FrameLayout> </FrameLayout>