Sfoglia il codice sorgente

Fix status/navigation bar colors (fixes #2858)

arkon 5 anni fa
parent
commit
7c7d40ea44

+ 0 - 4
app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt

@@ -37,10 +37,6 @@ class WebViewActivity : BaseActivity() {
         binding = WebviewActivityBinding.inflate(layoutInflater)
         setContentView(binding.root)
 
-        // Manually override status bar color since it's normally transparent with the app themes
-        // This is needed to hide the app bar when it scrolls up
-        window.statusBarColor = getResourceColor(R.attr.colorPrimaryDark)
-
         title = intent.extras?.getString(TITLE_KEY)
         setSupportActionBar(binding.toolbar)
         supportActionBar?.setDisplayHomeAsUpEnabled(true)

+ 0 - 4
app/src/main/java/eu/kanade/tachiyomi/widget/SimpleNavigationView.kt

@@ -54,10 +54,6 @@ open class SimpleNavigationView @JvmOverloads constructor(
                     R.styleable.NavigationView_elevation, 0).toFloat())
         }
 
-        @Suppress("DEPRECATION")
-        ViewCompat.setFitsSystemWindows(this,
-                a.getBoolean(R.styleable.NavigationView_android_fitsSystemWindows, false))
-
         maxWidth = a.getDimensionPixelSize(R.styleable.NavigationView_android_maxWidth, 0)
 
         a.recycle()

+ 1 - 2
app/src/main/res/layout/catalogue_controller.xml

@@ -7,8 +7,7 @@
 
     <FrameLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:fitsSystemWindows="true">
+        android:layout_height="match_parent">
 
         <LinearLayout
             android:id="@+id/catalogue_view"

+ 0 - 1
app/src/main/res/layout/main_activity.xml

@@ -3,7 +3,6 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:fitsSystemWindows="true"
     android:orientation="vertical">
 
     <eu.kanade.tachiyomi.widget.ElevationAppBarLayout

+ 0 - 1
app/src/main/res/layout/webview_activity.xml

@@ -3,7 +3,6 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:fitsSystemWindows="true"
     android:orientation="vertical">
 
     <com.google.android.material.appbar.AppBarLayout

+ 5 - 12
app/src/main/res/values/themes.xml

@@ -43,6 +43,8 @@
         <item name="android:textDirection">locale</item>
 
         <!-- Themes -->
+        <item name="android:statusBarColor">?attr/colorPrimary</item>
+        <item name="android:navigationBarColor">?attr/colorPrimary</item>
         <item name="windowActionModeOverlay">true</item>
         <item name="elevationOverlayEnabled">false</item>
         <item name="actionBarPopupTheme">@style/ThemeOverlay.MaterialComponents</item>
@@ -65,7 +67,6 @@
     <!-- Main Theme-->
     <!--===========-->
     <style name="Theme.Tachiyomi.Light" parent="Theme.Base">
-        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
         <item name="android:statusBarColor">@color/md_black_1000_54</item>
         <item name="android:navigationBarColor">@color/md_black_1000_54</item>
 
@@ -73,10 +74,6 @@
     </style>
 
     <style name="Theme.Tachiyomi.LightBlue" parent="Theme.Base">
-        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
-        <item name="android:statusBarColor">@android:color/transparent</item>
-        <item name="android:navigationBarColor">@color/colorPrimaryDark</item>
-
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorOnPrimary">@color/textColorPrimaryDark</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -116,11 +113,9 @@
         <item name="android:divider">@color/dividerDark</item>
         <item name="android:listDivider">@drawable/line_divider</item>
 
-        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
-        <item name="android:statusBarColor">@android:color/transparent</item>
-        <item name="android:navigationBarColor">@color/colorDarkPrimary</item>
-
         <!-- Themes -->
+        <item name="android:statusBarColor">?attr/colorPrimary</item>
+        <item name="android:navigationBarColor">?attr/colorPrimary</item>
         <item name="windowActionModeOverlay">true</item>
         <item name="elevationOverlayEnabled">false</item>
         <item name="actionBarTheme">@style/ThemeOverlay.MaterialComponents.Dark.ActionBar</item>
@@ -144,14 +139,11 @@
     </style>
 
     <style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark">
-        <!-- Attributes specific for SDK 16 to SDK 20 -->
     </style>
 
     <style name="Theme.Tachiyomi.DarkBlue" parent="Theme.Base.Dark">
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimary</item>
-
-        <item name="android:navigationBarColor">@color/colorPrimary</item>
     </style>
 
     <!--==============-->
@@ -164,6 +156,7 @@
 
         <item name="android:colorBackground">@color/colorAmoledPrimary</item>
 
+        <!-- Some ROMs make black navbars white (e.g. OxygenOS) -->
         <item name="android:navigationBarColor">@android:color/transparent</item>
 
         <!-- Themes -->