settings for pure black oled

This commit is contained in:
Katharine Chui
2022-02-02 01:41:13 +08:00
parent 329be8abbb
commit d3b8569ef7
9 changed files with 83 additions and 10 deletions

View File

@@ -16,10 +16,21 @@ public class CatimaAppCompatActivity extends AppCompatActivity {
super.attachBaseContext(Utils.updateBaseContextLocale(base));
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// XXX on the splash screen activity, aka the main activity, this has to be executed after applying dynamic colors, not before
// so running this only on non main for now
if (!this.getClass().getSimpleName().equals(MainActivity.class.getSimpleName())) {
Utils.patchOledDarkTheme(this);
}
}
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// material you themes uses background color for top bar, let the layout underneath show through
// material 3 designer does not consider status bar colors
// XXX changing this in onCreate causes issues with the splash screen activity, so doing this here
if (Build.VERSION.SDK_INT >= 23) {
getWindow().setStatusBarColor(Color.TRANSPARENT);
getWindow().getDecorView().setSystemUiVisibility(Utils.isDarkModeEnabled(this) ? 0 : View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
@@ -27,5 +38,10 @@ public class CatimaAppCompatActivity extends AppCompatActivity {
// icons are always white back then
getWindow().setStatusBarColor(Utils.isDarkModeEnabled(this) ? Color.TRANSPARENT : Color.argb(127, 0, 0, 0));
}
// XXX android 9 and below has a nasty rendering bug if the theme was patched earlier
// the splash screen activity needs the fix regardless to solve a dynamic color api issue
if (!this.getClass().getSimpleName().equals(MainActivity.class.getSimpleName())) {
Utils.postPatchOledDarkTheme(this);
}
}
}