dismiss apg deprecation dialog on pause, to avoid potential memory leak
@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map;
import android.app.Dialog;
+import android.app.DialogFragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.DialogInterface;
@@ -752,6 +753,7 @@ public class AccountSettings extends K9PreferenceActivity {
fragment.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
+ // this leaks the activity into the fragment, so make sure to dismiss in onPause!
mCryptoApp.show();
}
});
@@ -761,6 +763,13 @@ public class AccountSettings extends K9PreferenceActivity {
ta.commitAllowingStateLoss();
}
+ private void dismissApgDeprecationDialogIfDisplayed() {
+ DialogFragment dialog = (DialogFragment) getFragmentManager().findFragmentByTag(APG_DEPRECATION_DIALOG_TAG);
+ if (dialog != null) {
+ dialog.dismiss();
+ }
+ }
+
private void removeListEntry(ListPreference listPreference, String remove) {
CharSequence[] entryValues = listPreference.getEntryValues();
CharSequence[] entries = listPreference.getEntries();
@@ -909,6 +918,7 @@ public class AccountSettings extends K9PreferenceActivity {
@Override
protected void onPause() {
+ dismissApgDeprecationDialogIfDisplayed();
saveSettings();
super.onPause();
}
