1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-05 18:11:44 +01:00

Hiding controls when orientation changes to landscape

This commit is contained in:
Avently 2020-09-15 22:10:38 +03:00
parent a5312c1341
commit 5ada0ae2c7
3 changed files with 15 additions and 6 deletions

View File

@ -2105,7 +2105,6 @@ public class VideoDetailFragment
// Let's give a user time to look at video information page if video is not playing
if (orientationLocked && !player.isPlaying()) {
player.onPlay();
player.showControlsThenHide();
}
}

View File

@ -753,8 +753,16 @@ public class VideoPlayerImpl extends VideoPlayer
}
isFullscreen = !isFullscreen;
// Prevent applying windows insets twice (open vertical video to reproduce)
getRootView().findViewById(R.id.playbackControlRoot).setPadding(0, 0, 0, 0);
if (!isFullscreen) {
// Apply window insets because Android will not do it when orientation changes
// from landscape to portrait (open vertical video to reproduce)
getControlsRoot().setPadding(0, 0, 0, 0);
} else {
// Android needs tens milliseconds to send new insets but a user is able to see
// how controls changes it's position from `0` to `nav bar height` padding.
// So just hide the controls to hide this visual inconsistency
hideControls(0, 0);
}
fragmentListener.onFullscreenStateChanged(isFullscreen());
}
@ -1926,8 +1934,11 @@ public class VideoPlayerImpl extends VideoPlayer
public void setFragmentListener(final PlayerServiceEventListener listener) {
fragmentListener = listener;
fragmentIsVisible = true;
// Prevent applying windows insets twice
getRootView().findViewById(R.id.playbackControlRoot).setPadding(0, 0, 0, 0);
// Apply window insets because Android will not do it when orientation changes
// from landscape to portrait
if (!isFullscreen) {
getControlsRoot().setPadding(0, 0, 0, 0);
}
queueLayout.setPadding(0, 0, 0, 0);
updateMetadata();
updatePlayback();

View File

@ -20,7 +20,6 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:fitsSystemWindows="true"
android:isScrollContainer="true">
<com.google.android.material.appbar.AppBarLayout