Explicitly recreate on ui mode changes

pull/199/head
M66B 4 years ago
parent f3d21f78f9
commit 3ad79fe6a2

@ -153,18 +153,21 @@
<activity
android:name=".ActivitySetup"
android:configChanges="uiMode"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySignature"
android:configChanges="uiMode"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivitySetup" />
<activity
android:name=".ActivityWidget"
android:configChanges="uiMode"
android:exported="true">
<intent-filter>
@ -174,6 +177,7 @@
<activity
android:name=".ActivityWidgetSync"
android:configChanges="uiMode"
android:exported="true">
<intent-filter>
@ -183,6 +187,7 @@
<activity
android:name=".ActivityWidgetUnified"
android:configChanges="uiMode"
android:exported="true">
<intent-filter>
@ -192,6 +197,7 @@
<activity
android:name=".ActivityView"
android:configChanges="uiMode"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain" />
@ -215,6 +221,7 @@
<activity
android:name=".ActivityCompose"
android:configChanges="uiMode"
android:exported="true"
android:launchMode="singleTask"
android:parentActivityName=".ActivityView">
@ -244,6 +251,7 @@
<activity
android:name=".ActivityEML"
android:configChanges="uiMode"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask">
@ -278,6 +286,7 @@
<activity
android:name=".ActivityDSN"
android:configChanges="uiMode"
android:exported="true"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask">
@ -298,6 +307,7 @@
<activity
android:name=".ActivityBilling"
android:configChanges="uiMode"
android:exported="false"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTask" />

@ -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

Loading…
Cancel
Save