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:
parent
a73de95291
commit
6a3d0a7a7f
1 changed files with 24 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue