1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-25 01:06:04 +00:00

Defer apply theme on import

This commit is contained in:
M66B 2022-08-08 22:17:18 +02:00
parent a73de95291
commit 6a3d0a7a7f

View file

@ -910,9 +910,27 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
TextView tvLog = dview.findViewById(R.id.tvLog);
tvLog.setText(null);
Map<String, Object> defer = new HashMap<>();
AlertDialog dialog = new AlertDialog.Builder(this)
.setView(dview)
.setPositiveButton(android.R.string.ok, null)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(dview.getContext());
SharedPreferences.Editor editor = prefs.edit();
for (String key : defer.keySet()) {
Object value = defer.get(key);
if (value instanceof Boolean)
editor.putBoolean(key, (Boolean) value);
else if (value instanceof String)
editor.putString(key, (String) value);
}
editor.apply();
}
})
.show();
Button ok = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
@ -1313,6 +1331,11 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
"wal".equals(key))
continue;
if ("theme".equals(key) || "beige".equals(key)) {
defer.put(key, jsetting.get("value"));
continue;
}
if (key != null && key.startsWith("widget."))
continue;