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

Android 11: transparent navigation and status bars

This commit is contained in:
Avently 2020-09-14 11:30:41 +03:00
parent 011cc7d337
commit 6d38615ea8
4 changed files with 30 additions and 2 deletions

View File

@ -2003,6 +2003,10 @@ public class VideoDetailFragment
} }
activity.getWindow().getDecorView().setSystemUiVisibility(0); activity.getWindow().getDecorView().setSystemUiVisibility(0);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 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() { private void hideSystemUi() {

View File

@ -27,6 +27,7 @@ import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.graphics.Point; import android.graphics.Point;
import android.net.Uri; import android.net.Uri;
@ -1475,6 +1476,9 @@ public class VideoPlayerImpl extends VideoPlayer
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
getParentActivity().getWindow().getDecorView().setSystemUiVisibility(visibility); getParentActivity().getWindow().getDecorView().setSystemUiVisibility(visibility);
if (Build.VERSION.SDK_INT >= 30 /*Android 11*/) {
getParentActivity().getWindow().setStatusBarColor(Color.TRANSPARENT);
}
} }
} }

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.V29.LightTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:enforceNavigationBarContrast">false</item>
</style>
<style name="Base.LightTheme" parent="Base.V29.LightTheme" />
<style name="Base.V29.DarkTheme" parent="Base.V7.DarkTheme">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:enforceNavigationBarContrast">false</item>
</style>
<style name="Base.DarkTheme" parent="Base.V29.DarkTheme" />
<style name="Base.V29.BlackTheme" parent="Base.V7.BlackTheme">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:enforceNavigationBarContrast">false</item>
</style>
<style name="Base.BlackTheme" parent="Base.V29.BlackTheme" />
</resources>

View File

@ -9,8 +9,8 @@
</style> </style>
<!-- Base themes --> <!-- Base themes -->
<style name="Base.LightTheme" parent="Theme.AppCompat.Light.NoActionBar" />
<style name="LightTheme" parent="Theme.AppCompat.Light.NoActionBar"> <style name="LightTheme" parent="Base.LightTheme">
<item name="colorPrimary">@color/light_youtube_primary_color</item> <item name="colorPrimary">@color/light_youtube_primary_color</item>
<item name="colorPrimaryDark">@color/light_youtube_primary_color</item> <item name="colorPrimaryDark">@color/light_youtube_primary_color</item>
<item name="colorAccent">@color/light_youtube_accent_color</item> <item name="colorAccent">@color/light_youtube_accent_color</item>