From 6d38615ea8453a712e487e4ab9409ac7ecf73a34 Mon Sep 17 00:00:00 2001
From: Avently <7953703+avently@users.noreply.github.com>
Date: Mon, 14 Sep 2020 11:30:41 +0300
Subject: [PATCH] Android 11: transparent navigation and status bars
---
.../fragments/detail/VideoDetailFragment.java | 4 ++++
.../newpipe/player/VideoPlayerImpl.java | 4 ++++
app/src/main/res/values-v29/themes.xml | 20 +++++++++++++++++++
app/src/main/res/values/styles.xml | 4 ++--
4 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 app/src/main/res/values-v29/themes.xml
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
index 319523ab7..eddefaa8c 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
@@ -2003,6 +2003,10 @@ public class VideoDetailFragment
}
activity.getWindow().getDecorView().setSystemUiVisibility(0);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
+ if (Build.VERSION.SDK_INT >= 30 /*Android 11*/) {
+ activity.getWindow().setStatusBarColor(ThemeHelper.resolveColorFromAttr(
+ requireContext(), android.R.attr.colorPrimary));
+ }
}
private void hideSystemUi() {
diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java
index 52df3d956..ede476653 100644
--- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java
+++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayerImpl.java
@@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.ContentObserver;
import android.graphics.Bitmap;
+import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.net.Uri;
@@ -1475,6 +1476,9 @@ public class VideoPlayerImpl extends VideoPlayer
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
getParentActivity().getWindow().getDecorView().setSystemUiVisibility(visibility);
+ if (Build.VERSION.SDK_INT >= 30 /*Android 11*/) {
+ getParentActivity().getWindow().setStatusBarColor(Color.TRANSPARENT);
+ }
}
}
diff --git a/app/src/main/res/values-v29/themes.xml b/app/src/main/res/values-v29/themes.xml
new file mode 100644
index 000000000..63494d0ae
--- /dev/null
+++ b/app/src/main/res/values-v29/themes.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 9a81d01e1..1d6c31326 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -9,8 +9,8 @@
-
-