1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-16 10:19:59 +00:00

Merge pull request #7924 from litetex/revert-7451

Revert "Respect cutouts when playing in MultiWindow"
This commit is contained in:
Tobi 2022-02-21 21:36:07 +01:00 committed by GitHub
commit c42f29446d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1994,9 +1994,7 @@ public final class VideoDetailFragment
// Prevent jumping of the player on devices with cutout // Prevent jumping of the player on devices with cutout
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activity.getWindow().getAttributes().layoutInDisplayCutoutMode = activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
isMultiWindowOrFullscreen() WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
? WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
: WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
} }
activity.getWindow().getDecorView().setSystemUiVisibility(0); activity.getWindow().getDecorView().setSystemUiVisibility(0);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
@ -2018,9 +2016,7 @@ public final class VideoDetailFragment
// Prevent jumping of the player on devices with cutout // Prevent jumping of the player on devices with cutout
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activity.getWindow().getAttributes().layoutInDisplayCutoutMode = activity.getWindow().getAttributes().layoutInDisplayCutoutMode =
isMultiWindowOrFullscreen() WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
? WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
: WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
} }
int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
@ -2037,7 +2033,7 @@ public final class VideoDetailFragment
activity.getWindow().getDecorView().setSystemUiVisibility(visibility); activity.getWindow().getDecorView().setSystemUiVisibility(visibility);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& isMultiWindowOrFullscreen()) { && (isInMultiWindow || (isPlayerAvailable() && player.isFullscreen()))) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT); activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow().setNavigationBarColor(Color.TRANSPARENT); activity.getWindow().setNavigationBarColor(Color.TRANSPARENT);
} }
@ -2053,11 +2049,6 @@ public final class VideoDetailFragment
} }
} }
private boolean isMultiWindowOrFullscreen() {
return DeviceUtils.isInMultiWindow(activity)
|| (isPlayerAvailable() && player.isFullscreen());
}
private boolean playerIsNotStopped() { private boolean playerIsNotStopped() {
return isPlayerAvailable() && !player.isStopped(); return isPlayerAvailable() && !player.isStopped();
} }