Fix theme bar color

This commit is contained in:
Thomas 2022-12-18 11:38:51 +01:00
parent 769c713a55
commit 3fcb0cc6e0
5 changed files with 25 additions and 28 deletions

View File

@ -19,11 +19,8 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
@ -84,9 +81,6 @@ public class BaseActivity extends AppCompatActivity {
break;
case "BLACK":
setTheme(R.style.BlackAppTheme);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
currentThemeId = R.style.BlackAppTheme;
break;
case "DRACULA":
@ -121,9 +115,6 @@ public class BaseActivity extends AppCompatActivity {
case "BLACK":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
setTheme(R.style.BlackAppTheme);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
currentThemeId = R.style.BlackAppTheme;
break;
case "DRACULA":

View File

@ -19,11 +19,8 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
@ -76,9 +73,6 @@ public class BaseBarActivity extends AppCompatActivity {
setTheme(R.style.SolarizedAppThemeBar);
break;
case "BLACK":
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
setTheme(R.style.BlackAppThemeBar);
break;
case "DRACULA":
@ -108,9 +102,6 @@ public class BaseBarActivity extends AppCompatActivity {
break;
case "BLACK":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
setTheme(R.style.BlackAppThemeBar);
break;
case "DRACULA":

View File

@ -19,11 +19,8 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
@ -76,9 +73,6 @@ public class BaseTransparentActivity extends AppCompatActivity {
setTheme(R.style.TransparentSolarized);
break;
case "BLACK":
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
setTheme(R.style.TransparentBlack);
break;
case "DRACULA":
@ -108,9 +102,6 @@ public class BaseTransparentActivity extends AppCompatActivity {
break;
case "BLACK":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
setTheme(R.style.TransparentBlack);
break;
case "DRACULA":

View File

@ -4,7 +4,7 @@
<style name="AppTheme" parent="Theme.Material3.Dark.NoActionBar">
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="android:statusBarColor">?android:colorBackground</item>
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
<item name="colorPrimaryContainer">@color/md_theme_dark_primaryContainer</item>
@ -23,6 +23,7 @@
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
<item name="colorOutline">@color/md_theme_dark_outline</item>
<item name="android:colorBackground">@color/md_theme_dark_background</item>
<item name="statusBar">@color/md_theme_dark_background</item>
<item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
<item name="colorSurface">@color/md_theme_dark_surface</item>
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
@ -47,6 +48,7 @@
</style>
<style name="AppThemeBar" parent="Theme.Material3.Dark">
<item name="android:statusBarColor">?android:colorBackground</item>
<item name="linkColor">@color/md_theme_dark_primary</item>
<item name="colorPrimary">@color/md_theme_dark_primary</item>
<item name="colorOnPrimary">@color/md_theme_dark_onPrimary</item>
@ -66,6 +68,7 @@
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
<item name="colorOutline">@color/md_theme_dark_outline</item>
<item name="android:colorBackground">@color/md_theme_dark_background</item>
<item name="statusBar">@color/md_theme_dark_background</item>
<item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
<item name="colorSurface">@color/md_theme_dark_surface</item>
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
@ -101,6 +104,7 @@
<item name="colorOnErrorContainer">@color/md_theme_dark_onErrorContainer</item>
<item name="colorOutline">@color/md_theme_dark_outline</item>
<item name="android:colorBackground">@color/md_theme_dark_background</item>
<item name="statusBar">@color/md_theme_dark_background</item>
<item name="colorOnBackground">@color/md_theme_dark_onBackground</item>
<item name="colorSurface">@color/md_theme_dark_surface</item>
<item name="colorOnSurface">@color/md_theme_dark_onSurface</item>
@ -138,6 +142,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/solarized_md_theme_dark_background</item>
<item name="statusBar">@color/solarized_md_theme_dark_background</item>
<item name="colorOnBackground">@color/solarized_md_theme_dark_onBackground</item>
<item name="colorSurface">@color/solarized_md_theme_dark_surface</item>
<item name="colorOnSurface">@color/solarized_md_theme_dark_onSurface</item>
@ -172,6 +177,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/solarized_md_theme_dark_background</item>
<item name="statusBar">@color/solarized_md_theme_dark_background</item>
<item name="colorOnBackground">@color/solarized_md_theme_dark_onBackground</item>
<item name="colorSurface">@color/solarized_md_theme_dark_surface</item>
<item name="colorOnSurface">@color/solarized_md_theme_dark_onSurface</item>
@ -185,6 +191,7 @@
<style name="TransparentSolarized" parent="SolarizedAppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="statusBar">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
@ -214,6 +221,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/solarized_md_theme_dark_background</item>
<item name="statusBar">@color/solarized_md_theme_dark_background</item>
<item name="colorOnBackground">@color/solarized_md_theme_dark_onBackground</item>
<item name="colorSurface">@color/solarized_md_theme_dark_surface</item>
<item name="colorOnSurface">@color/solarized_md_theme_dark_onSurface</item>
@ -246,6 +254,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/black</item>
<item name="statusBar">@color/black</item>
<item name="colorOnBackground">@color/white</item>
<item name="colorSurface">@color/black</item>
<item name="colorOnSurface">@color/white</item>
@ -276,6 +285,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/black</item>
<item name="statusBar">@color/black</item>
<item name="colorOnBackground">@color/white</item>
<item name="colorSurface">@color/black</item>
<item name="colorOnSurface">@color/white</item>
@ -289,6 +299,7 @@
<style name="TransparentBlack" parent="BlackAppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="statusBar">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
@ -314,6 +325,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/black</item>
<item name="statusBar">@color/black</item>
<item name="colorOnBackground">@color/white</item>
<item name="colorSurface">@color/black</item>
<item name="colorOnSurface">@color/white</item>
@ -347,6 +359,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/dracula_background</item>
<item name="statusBar">@color/dracula_background</item>
<item name="colorOnBackground">@color/dracula_foreground</item>
<item name="colorSurface">@color/dracula_background</item>
<item name="colorOnSurface">@color/dracula_foreground</item>
@ -378,6 +391,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/dracula_background</item>
<item name="statusBar">@color/dracula_background</item>
<item name="colorOnBackground">@color/dracula_foreground</item>
<item name="colorSurface">@color/dracula_background</item>
<item name="colorOnSurface">@color/dracula_foreground</item>
@ -391,6 +405,7 @@
<style name="TransparentDracula" parent="DraculaAppThemeBar">
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="statusBar">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
@ -416,6 +431,7 @@
<item name="colorOnError">@color/solarized_md_theme_dark_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_dark_onErrorContainer</item>
<item name="android:colorBackground">@color/dracula_background</item>
<item name="statusBar">@color/dracula_background</item>
<item name="colorOnBackground">@color/dracula_foreground</item>
<item name="colorSurface">@color/dracula_background</item>
<item name="colorOnSurface">@color/dracula_foreground</item>

View File

@ -1,6 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<attr name="linkColor" type="color" />
<attr name="statusBar" type="color" />
<style name="AppTheme" parent="Theme.Material3.Light.NoActionBar">
<item name="linkColor">@color/md_theme_light_primary</item>
@ -22,6 +23,7 @@
<item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
<item name="colorOutline">@color/md_theme_light_outline</item>
<item name="android:colorBackground">@color/md_theme_light_background</item>
<item name="statusBar">@color/md_theme_light_background</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground</item>
<item name="colorSurface">@color/md_theme_light_surface</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface</item>
@ -43,6 +45,7 @@
</item>
<item name="android:windowSharedElementExitTransition">@transition/change_image_transform
</item>
<item name="android:statusBarColor">?android:colorBackground</item>
</style>
<style name="AppThemeBar" parent="Theme.Material3.Light">
@ -65,6 +68,7 @@
<item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
<item name="colorOutline">@color/md_theme_light_outline</item>
<item name="android:colorBackground">@color/md_theme_light_background</item>
<item name="statusBar">@color/md_theme_light_background</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground</item>
<item name="colorSurface">@color/md_theme_light_surface</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface</item>
@ -77,6 +81,7 @@
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:isLightTheme" tools:targetApi="q">true</item>
<item name="android:statusBarColor">?android:colorBackground</item>
</style>
<style name="Transparent" parent="AppThemeBar">
@ -107,6 +112,7 @@
<item name="colorOnErrorContainer">@color/md_theme_light_onErrorContainer</item>
<item name="colorOutline">@color/md_theme_light_outline</item>
<item name="android:colorBackground">@color/md_theme_light_background</item>
<item name="statusBar">@color/md_theme_light_background</item>
<item name="colorOnBackground">@color/md_theme_light_onBackground</item>
<item name="colorSurface">@color/md_theme_light_surface</item>
<item name="colorOnSurface">@color/md_theme_light_onSurface</item>
@ -143,6 +149,7 @@
<item name="colorOnError">@color/solarized_md_theme_light_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_light_onErrorContainer</item>
<item name="android:colorBackground">@color/solarized_md_theme_light_background</item>
<item name="statusBar">@color/solarized_md_theme_light_background</item>
<item name="colorOnBackground">@color/solarized_md_theme_light_onBackground</item>
<item name="colorSurface">@color/solarized_md_theme_light_surface</item>
<item name="colorOnSurface">@color/solarized_md_theme_light_onSurface</item>
@ -186,6 +193,7 @@
<item name="colorOnError">@color/solarized_md_theme_light_onError</item>
<item name="colorOnErrorContainer">@color/solarized_md_theme_light_onErrorContainer</item>
<item name="android:colorBackground">@color/solarized_md_theme_light_background</item>
<item name="statusBar">@color/solarized_md_theme_light_background</item>
<item name="colorOnBackground">@color/solarized_md_theme_light_onBackground</item>
<item name="colorSurface">@color/solarized_md_theme_light_surface</item>
<item name="colorOnSurface">@color/solarized_md_theme_light_onSurface</item>