diff --git a/k9mail/src/main/java/com/fsck/k9/K9.java b/k9mail/src/main/java/com/fsck/k9/K9.java index 8b64f696d..36eaedf6d 100644 --- a/k9mail/src/main/java/com/fsck/k9/K9.java +++ b/k9mail/src/main/java/com/fsck/k9/K9.java @@ -21,6 +21,7 @@ import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.pm.PackageManager; import android.net.Uri; +import android.os.AsyncTask; import android.os.Environment; import android.os.Handler; import android.os.Looper; @@ -1435,4 +1436,18 @@ public class K9 extends Application { } } + public static void saveSettingsAsync() { + new AsyncTask() { + @Override + protected Void doInBackground(Void... voids) { + Preferences prefs = Preferences.getPreferences(app); + StorageEditor editor = prefs.getStorage().edit(); + save(editor); + editor.commit(); + + return null; + } + }.execute(); + } + } diff --git a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java index ec326a1f0..a66209300 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java @@ -756,6 +756,7 @@ public class RecipientPresenter implements PermissionPingCallback { int pgpInlineDialogCounter = K9.getPgpInlineDialogCounter(); if (pgpInlineDialogCounter < PGP_DIALOG_DISPLAY_THRESHOLD) { K9.setPgpInlineDialogCounter(pgpInlineDialogCounter + 1); + K9.saveSettingsAsync(); return true; } return false; @@ -765,6 +766,7 @@ public class RecipientPresenter implements PermissionPingCallback { int pgpSignOnlyDialogCounter = K9.getPgpSignOnlyDialogCounter(); if (pgpSignOnlyDialogCounter < PGP_DIALOG_DISPLAY_THRESHOLD) { K9.setPgpSignOnlyDialogCounter(pgpSignOnlyDialogCounter + 1); + K9.saveSettingsAsync(); return true; } return false;