Fix issue #603 - Fix status bar color

This commit is contained in:
Thomas 2022-12-12 14:51:34 +01:00
parent 5a0eff4ae8
commit 202e527b5f
4 changed files with 36 additions and 0 deletions

View File

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

View File

@ -19,8 +19,11 @@ import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
@ -74,6 +77,9 @@ public class BaseAlertDialogActivity extends AppCompatActivity {
setTheme(R.style.SolarizedAlertDialog); setTheme(R.style.SolarizedAlertDialog);
break; break;
case "BLACK": case "BLACK":
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLACK);
setTheme(R.style.BlackAlertDialog); setTheme(R.style.BlackAlertDialog);
break; break;
case "DRACULA": case "DRACULA":
@ -102,6 +108,9 @@ public class BaseAlertDialogActivity extends AppCompatActivity {
break; break;
case "BLACK": case "BLACK":
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); 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.BlackAlertDialog); setTheme(R.style.BlackAlertDialog);
break; break;
case "DRACULA": case "DRACULA":

View File

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

View File

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