From 91aa65e71709913236b7fa9621f3d622201f28cc Mon Sep 17 00:00:00 2001 From: Marcel Dopita Date: Sat, 18 Jan 2020 14:37:42 +0100 Subject: [PATCH] Support display cutout Fixes #2682 --- app/src/main/AndroidManifest.xml | 3 ++- .../schabi/newpipe/player/MainVideoPlayer.java | 15 +++++++++++++++ app/src/main/res/values-v28/styles.xml | 8 ++++++++ app/src/main/res/values/styles.xml | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/values-v28/styles.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f27f4bad0..7ca04eed0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -61,7 +61,8 @@ android:name=".player.MainVideoPlayer" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:label="@string/app_name" - android:launchMode="singleTask"/> + android:launchMode="singleTask" + android:theme="@style/VideoPlayerTheme"/> = Build.VERSION_CODES.P) { + queueLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { + @Override + public WindowInsets onApplyWindowInsets(View view, WindowInsets windowInsets) { + final DisplayCutout cutout = windowInsets.getDisplayCutout(); + if (cutout != null) + view.setPadding(cutout.getSafeInsetLeft(), cutout.getSafeInsetTop(), + cutout.getSafeInsetRight(), cutout.getSafeInsetBottom()); + return windowInsets; + } + }); + } } public void minimize() { diff --git a/app/src/main/res/values-v28/styles.xml b/app/src/main/res/values-v28/styles.xml new file mode 100644 index 000000000..92c2d9214 --- /dev/null +++ b/app/src/main/res/values-v28/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8047ef7f4..633003092 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -247,4 +247,6 @@ + +