Merge pull request #2496 from k9mail/persist-dialog-counters
Persist dialog counters
This commit is contained in:
commit
24c8c25eef
2 changed files with 17 additions and 0 deletions
|
@ -21,6 +21,7 @@ import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
@ -1435,4 +1436,18 @@ public class K9 extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void saveSettingsAsync() {
|
||||||
|
new AsyncTask<Void,Void,Void>() {
|
||||||
|
@Override
|
||||||
|
protected Void doInBackground(Void... voids) {
|
||||||
|
Preferences prefs = Preferences.getPreferences(app);
|
||||||
|
StorageEditor editor = prefs.getStorage().edit();
|
||||||
|
save(editor);
|
||||||
|
editor.commit();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}.execute();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -756,6 +756,7 @@ public class RecipientPresenter implements PermissionPingCallback {
|
||||||
int pgpInlineDialogCounter = K9.getPgpInlineDialogCounter();
|
int pgpInlineDialogCounter = K9.getPgpInlineDialogCounter();
|
||||||
if (pgpInlineDialogCounter < PGP_DIALOG_DISPLAY_THRESHOLD) {
|
if (pgpInlineDialogCounter < PGP_DIALOG_DISPLAY_THRESHOLD) {
|
||||||
K9.setPgpInlineDialogCounter(pgpInlineDialogCounter + 1);
|
K9.setPgpInlineDialogCounter(pgpInlineDialogCounter + 1);
|
||||||
|
K9.saveSettingsAsync();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -765,6 +766,7 @@ public class RecipientPresenter implements PermissionPingCallback {
|
||||||
int pgpSignOnlyDialogCounter = K9.getPgpSignOnlyDialogCounter();
|
int pgpSignOnlyDialogCounter = K9.getPgpSignOnlyDialogCounter();
|
||||||
if (pgpSignOnlyDialogCounter < PGP_DIALOG_DISPLAY_THRESHOLD) {
|
if (pgpSignOnlyDialogCounter < PGP_DIALOG_DISPLAY_THRESHOLD) {
|
||||||
K9.setPgpSignOnlyDialogCounter(pgpSignOnlyDialogCounter + 1);
|
K9.setPgpSignOnlyDialogCounter(pgpSignOnlyDialogCounter + 1);
|
||||||
|
K9.saveSettingsAsync();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue