Explicitly recreate on ui mode changes

This commit is contained in:
M66B
2021-07-13 08:21:43 +02:00
parent f3d21f78f9
commit 3ad79fe6a2
2 changed files with 17 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ import java.util.Map;
abstract class ActivityBase extends AppCompatActivity implements SharedPreferences.OnSharedPreferenceChangeListener {
private Context originalContext;
private int themeId;
private boolean visible;
private boolean contacts;
private List<IKeyPressedListener> keyPressedListeners = new ArrayList<>();
@@ -98,7 +99,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
if (!this.getClass().equals(ActivityMain.class)) {
setTheme(FragmentDialogTheme.getTheme(this));
themeId = FragmentDialogTheme.getTheme(this);
setTheme(themeId);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
boolean dark = Helper.isDarkTheme(this);
@@ -192,6 +194,10 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
public void onConfigurationChanged(Configuration newConfig) {
Log.d("Config " + this.getClass().getName());
super.onConfigurationChanged(newConfig);
if (!this.getClass().equals(ActivityMain.class) &&
themeId != FragmentDialogTheme.getTheme(this))
recreate();
}
@Override