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: 342162231
This commit is contained in:
olly 2020-11-13 01:00:36 +00:00 committed by Christos Tsilopoulos
parent 7fd78666d1
commit 8d84a50fa1
8 changed files with 23 additions and 49 deletions

View File

@ -36,6 +36,7 @@
`LeanbackPlayerAdapter` and use `ControlDispatcher` for dispatching
prepare instead
([#7882](https://github.com/google/ExoPlayer/issues/7882)).
* Switch StyledPlayerView button controls to borderless ripples.
* Audio:
* Retry playback after some types of `AudioTrack` error.
* Work around `AudioManager` crashes when calling `getStreamVolume`

View File

@ -14,13 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<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>

View File

@ -14,16 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<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>

View File

@ -14,16 +14,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<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>

View File

@ -14,13 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<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>

View File

@ -16,8 +16,10 @@
<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,8 +15,6 @@
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">?android:attr/selectableItemBackground</item>
<item name="android:background">@drawable/exo_selectable_item_background_borderless</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>
@ -134,6 +134,7 @@
</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>