Skip to content

Commit

Permalink
StyledPlayerView: Fix layout issues
Browse files Browse the repository at this point in the history
- Take centerControls padding into account to prevent switching to
  minimal mode too soon
- Disable clipping to padding to avoid the edges of controls from
  being clipped as the view gets smaller

Issue: google#8763
PiperOrigin-RevId: 366966298
  • Loading branch information
ojw28 authored and roblav96 committed Apr 17, 2021
1 parent 7d3a0d1 commit de9c090
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
* Fix measurement of `StyledPlayerView` and `StyledPlayerControlView` when
`wrap_content` is used
([#8726](https:/google/ExoPlayer/issues/8726)).
* Fix `StyledPlayerControlView` to stay in full mode (rather than minimal
mode) when possible
([#8763](https:/google/ExoPlayer/issues/8763)).
* Audio:
* Report unexpected discontinuities in
`AnalyticsListener.onAudioSinkError`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,13 +587,17 @@ private boolean useMinimalMode() {
- (centerControls != null
? (centerControls.getPaddingLeft() + centerControls.getPaddingRight())
: 0);
int centerControlHeight =
getHeightWithMargins(centerControls)
- (centerControls != null
? (centerControls.getPaddingTop() + centerControls.getPaddingBottom())
: 0);

int defaultModeMinimumWidth =
Math.max(
centerControlWidth,
getWidthWithMargins(timeView) + getWidthWithMargins(overflowShowButton));
int defaultModeMinimumHeight =
getHeightWithMargins(centerControls) + 2 * getHeightWithMargins(bottomBar);
int defaultModeMinimumHeight = centerControlHeight + (2 * getHeightWithMargins(bottomBar));

return width <= defaultModeMinimumWidth || height <= defaultModeMinimumHeight;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
android:layout_gravity="center"
android:background="@android:color/transparent"
android:gravity="center"
android:padding="@dimen/exo_styled_controls_padding">
android:padding="@dimen/exo_styled_controls_padding"
android:clipToPadding="false">

<ImageButton android:id="@id/exo_prev"
style="@style/ExoStyledControls.Button.Center.Previous"/>
Expand Down

0 comments on commit de9c090

Please sign in to comment.