diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/BaseActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/BaseActivity.java index 8507bda9..7c71a738 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/BaseActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/BaseActivity.java @@ -15,7 +15,9 @@ package app.fedilab.android.mastodon.activities; * see . */ +import static app.fedilab.android.BaseMainActivity.currentInstance; import static app.fedilab.android.BaseMainActivity.currentNightMode; +import static app.fedilab.android.BaseMainActivity.currentUserID; import android.annotation.SuppressLint; import android.content.Context; @@ -24,6 +26,7 @@ import android.content.res.Configuration; import android.graphics.Color; import android.os.Build; import android.os.Bundle; +import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -72,8 +75,20 @@ public class BaseActivity extends AppCompatActivity { } String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME)); + boolean customAccentEnabled = sharedpreferences.getBoolean(getString(R.string.SET_CUSTOM_ACCENT) + currentUserID + currentInstance, false); + //Default automatic switch currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + + + if(customAccentEnabled && currentNightMode == Configuration.UI_MODE_NIGHT_NO) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR|View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + } + if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) { switch (currentNightMode) { case Configuration.UI_MODE_NIGHT_NO -> { diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/BaseBarActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/BaseBarActivity.java index e606020b..94912f04 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/BaseBarActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/BaseBarActivity.java @@ -15,7 +15,9 @@ package app.fedilab.android.mastodon.activities; * see . */ +import static app.fedilab.android.BaseMainActivity.currentInstance; import static app.fedilab.android.BaseMainActivity.currentNightMode; +import static app.fedilab.android.BaseMainActivity.currentUserID; import android.annotation.SuppressLint; import android.content.Context; @@ -24,6 +26,7 @@ import android.content.res.Configuration; import android.graphics.Color; import android.os.Build; import android.os.Bundle; +import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -67,8 +70,16 @@ public class BaseBarActivity extends AppCompatActivity { } } String currentTheme = sharedpreferences.getString(getString(R.string.SET_THEME_BASE), getString(R.string.SET_DEFAULT_THEME)); + boolean customAccentEnabled = sharedpreferences.getBoolean(getString(R.string.SET_CUSTOM_ACCENT) + currentUserID + currentInstance, false); //Default automatic switch currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; + if(customAccentEnabled && currentNightMode == Configuration.UI_MODE_NIGHT_NO) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR|View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR); + }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); + } + } if (currentTheme.equals(getString(R.string.SET_DEFAULT_THEME))) { switch (currentNightMode) { case Configuration.UI_MODE_NIGHT_NO -> { diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 8344bd2c..0afe1d32 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -26,6 +26,7 @@ @color/md_theme_dark_background @color/md_theme_dark_onBackground @color/md_theme_dark_surface + @color/md_theme_dark_surface @color/md_theme_dark_onSurface @color/md_theme_dark_surfaceVariant @color/md_theme_dark_onSurfaceVariant @@ -72,6 +73,7 @@ @color/md_theme_dark_background @color/md_theme_dark_onBackground @color/md_theme_dark_surface + @color/md_theme_dark_surface @color/md_theme_dark_onSurface @color/md_theme_dark_surfaceVariant @color/md_theme_dark_onSurfaceVariant @@ -126,6 +128,7 @@ @color/md_theme_dark_background @color/md_theme_dark_onBackground @color/md_theme_dark_surface + @color/md_theme_dark_surface @color/md_theme_dark_onSurface @color/md_theme_dark_surfaceVariant @color/md_theme_dark_onSurfaceVariant @@ -164,6 +167,7 @@ @color/solarized_md_theme_dark_background @color/solarized_md_theme_dark_onBackground @color/solarized_md_theme_dark_surface + @color/solarized_md_theme_dark_surface @color/solarized_md_theme_dark_onSurface @color/solarized_md_theme_dark_surfaceVariant @color/solarized_md_theme_dark_onSurfaceVariant @@ -200,6 +204,7 @@ @color/solarized_md_theme_dark_background @color/solarized_md_theme_dark_onBackground @color/solarized_md_theme_dark_surface + @color/solarized_md_theme_dark_surface @color/solarized_md_theme_dark_onSurface @color/solarized_md_theme_dark_surfaceVariant @color/solarized_md_theme_dark_onSurfaceVariant @@ -255,6 +260,7 @@ @color/solarized_md_theme_dark_background @color/solarized_md_theme_dark_onBackground @color/solarized_md_theme_dark_surface + @color/solarized_md_theme_dark_surface @color/solarized_md_theme_dark_onSurface @color/solarized_md_theme_dark_surfaceVariant @color/solarized_md_theme_dark_onSurfaceVariant @@ -288,6 +294,7 @@ @color/black @color/white @color/black + @color/black @color/white @color/black @color/white @@ -320,6 +327,7 @@ @color/black @color/white @color/black + @color/black @color/white @color/black @color/white @@ -370,6 +378,7 @@ @color/black @color/white @color/black + @color/black @color/white @color/black @color/white @@ -404,6 +413,7 @@ @color/dracula_background @color/dracula_foreground @color/dracula_background + @color/dracula_background @color/dracula_foreground @color/dracula_current_Line @color/dracula_foreground @@ -437,6 +447,7 @@ @color/dracula_background @color/dracula_foreground @color/dracula_background + @color/dracula_background @color/dracula_foreground @color/dracula_current_Line @color/dracula_foreground @@ -488,6 +499,7 @@ @color/dracula_background @color/dracula_foreground @color/dracula_background + @color/dracula_background @color/dracula_foreground @color/dracula_current_Line @color/dracula_foreground