From eded1ca10612e7bc59c322ef7647e04ecb083e27 Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 7 Jan 2021 18:30:20 +0000 Subject: [PATCH] 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 --- RELEASENOTES.md | 10 +++--- .../StyledPlayerControlViewLayoutManager.java | 9 +++++- .../main/res/drawable-v21/exo_ripple_ffwd.xml | 26 --------------- .../src/main/res/drawable/exo_ripple_ffwd.xml | 29 ----------------- .../src/main/res/drawable/exo_ripple_rew.xml | 29 ----------------- .../exo_styled_player_control_ffwd_button.xml | 20 ++++++++++++ ...xo_styled_player_control_rewind_button.xml | 20 ++++++++++++ .../exo_styled_player_control_ffwd_button.xml | 32 +++++++++++++++++++ ...xo_styled_player_control_rewind_button.xml | 32 +++++++++++++++++++ .../layout/exo_styled_player_control_view.xml | 14 ++++---- library/ui/src/main/res/values-v21/dimens.xml | 18 +++++++++++ .../styles.xml} | 17 ++++------ library/ui/src/main/res/values/colors.xml | 2 -- library/ui/src/main/res/values/dimens.xml | 1 + library/ui/src/main/res/values/styles.xml | 4 +-- 15 files changed, 153 insertions(+), 110 deletions(-) delete mode 100644 library/ui/src/main/res/drawable-v21/exo_ripple_ffwd.xml delete mode 100644 library/ui/src/main/res/drawable/exo_ripple_ffwd.xml delete mode 100644 library/ui/src/main/res/drawable/exo_ripple_rew.xml create mode 100644 library/ui/src/main/res/layout-v23/exo_styled_player_control_ffwd_button.xml create mode 100644 library/ui/src/main/res/layout-v23/exo_styled_player_control_rewind_button.xml create mode 100644 library/ui/src/main/res/layout/exo_styled_player_control_ffwd_button.xml create mode 100644 library/ui/src/main/res/layout/exo_styled_player_control_rewind_button.xml create mode 100644 library/ui/src/main/res/values-v21/dimens.xml rename library/ui/src/main/res/{drawable-v21/exo_ripple_rew.xml => values-v21/styles.xml} (63%) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index f12907b972..4febfc7466 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -11,8 +11,7 @@ * Add `LiveConfiguration` to `MediaItem` to allow media-specific live offset and live playback speed settings. The same settings can be set for all `MediaItems` in `DefaultMediaSourceFactory`. - * Add `targetLiveOffsetUs` parameter to - `LoadControl.shouldStartPlayback`. + * Add `targetLiveOffsetUs` parameter to `LoadControl.shouldStartPlayback`. * Verify correct thread usage in `SimpleExoPlayer` by default. Opt-out is still possible until the next major release using `setThrowsWhenUsingWrongThread(false)` @@ -71,13 +70,14 @@ enough space. * Update StyledPlayer's control overlay scrim from 30% opacity to 60% opacity for Accessibility requirements. + * Switch `StyledPlayerControlView` button controls to borderless ripples. * DRM: * Fix playback failure when switching from PlayReady protected content to Widevine or Clearkey protected content in a playlist. * Downloads: - * Fix crash in `DownloadManager` that could occur when adding a stopped - download with the same ID as a download currently being removed - ([#8419](https://github.com/google/ExoPlayer/issues/8419)). + * Fix crash in `DownloadManager` that could occur when adding a stopped + download with the same ID as a download currently being removed + ([#8419](https://github.com/google/ExoPlayer/issues/8419)). * Analytics: * Pass a `DecoderReuseEvaluation` to `AnalyticsListener`'s `onVideoInputFormatChanged` and `onAudioInputFormatChanged` methods. The diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java index 5399435164..4045559ccb 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java @@ -571,9 +571,16 @@ import java.util.List; styledPlayerControlView.getHeight() - styledPlayerControlView.getPaddingBottom() - styledPlayerControlView.getPaddingTop(); + + int centerControlWidth = + getWidthWithMargins(centerControls) + - (centerControls != null + ? (centerControls.getPaddingLeft() + centerControls.getPaddingRight()) + : 0); + int defaultModeMinimumWidth = Math.max( - getWidthWithMargins(centerControls), + centerControlWidth, getWidthWithMargins(timeView) + getWidthWithMargins(overflowShowButton)); int defaultModeMinimumHeight = getHeightWithMargins(centerControls) + 2 * getHeightWithMargins(bottomBar); diff --git a/library/ui/src/main/res/drawable-v21/exo_ripple_ffwd.xml b/library/ui/src/main/res/drawable-v21/exo_ripple_ffwd.xml deleted file mode 100644 index 5e4dd5550f..0000000000 --- a/library/ui/src/main/res/drawable-v21/exo_ripple_ffwd.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - diff --git a/library/ui/src/main/res/drawable/exo_ripple_ffwd.xml b/library/ui/src/main/res/drawable/exo_ripple_ffwd.xml deleted file mode 100644 index 9f7e1fd027..0000000000 --- a/library/ui/src/main/res/drawable/exo_ripple_ffwd.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/library/ui/src/main/res/drawable/exo_ripple_rew.xml b/library/ui/src/main/res/drawable/exo_ripple_rew.xml deleted file mode 100644 index 5562b1352c..0000000000 --- a/library/ui/src/main/res/drawable/exo_ripple_rew.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/library/ui/src/main/res/layout-v23/exo_styled_player_control_ffwd_button.xml b/library/ui/src/main/res/layout-v23/exo_styled_player_control_ffwd_button.xml new file mode 100644 index 0000000000..18166f71f6 --- /dev/null +++ b/library/ui/src/main/res/layout-v23/exo_styled_player_control_ffwd_button.xml @@ -0,0 +1,20 @@ + + + + +