Skip to content

Commit 976f098

Browse files
committed
Fix bottom sheet state after automatic fullscreen
1 parent e5115d8 commit 976f098

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

+8
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,14 @@ public void openVideoPlayer(final boolean directlyFullscreenIfApplicable) {
11091109
&& PlayerHelper.isStartMainPlayerFullscreen(requireContext())
11101110
&& !DeviceUtils.isLandscape(requireContext())
11111111
&& PlayerHelper.globalScreenOrientationLocked(requireContext())) {
1112+
// Make sure the bottom sheet turns out expanded. When this code kicks in the bottom
1113+
// sheet could not have fully expanded yet, and thus be in the STATE_SETTLING state.
1114+
// When the activity is rotated, and its state is saved and then restored, the bottom
1115+
// sheet would forget what it was doing, since even if STATE_SETTLING is restored, it
1116+
// doesn't tell which state it was settling to, and thus the bottom sheet settles to
1117+
// STATE_COLLAPSED. This can be solved by manually setting the state that will be
1118+
// restored (i.e. bottomSheetState) to STATE_EXPANDED.
1119+
bottomSheetState = BottomSheetBehavior.STATE_EXPANDED;
11121120
// toggle landscape in order to open directly in fullscreen
11131121
onScreenRotationButtonClicked();
11141122
}

0 commit comments

Comments
 (0)