Explicitly recreate on ui mode changes

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

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

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

Loading…
Cancel
Save