Persist new value in ChangeCredentialsTask
Try to avoids problems when the calling activity is killed
This commit is contained in:
parent
d95dac1784
commit
2bec1e8224
3 changed files with 6 additions and 2 deletions
|
@ -191,8 +191,7 @@ public class SettingsActivity extends BaseActivity
|
|||
if (fragment.useAndroidSync != null)
|
||||
fragment.useAndroidSync.setEnabled(true);
|
||||
}
|
||||
} else if(key.equals(getString(R.string.settings_key_enable_android_backup_service)))
|
||||
{
|
||||
} else if(key.equals(getString(R.string.settings_key_enable_android_backup_service))) {
|
||||
Log.d(SettingsActivity.class.getSimpleName(), "onSharedPreferenceChanged called modifying settings_key_enable_android_backup_service service is now: " +
|
||||
(settings.getAndroidBackupServiceEnabled() ? "enabled" : "disabled"));
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ public class CredentialsPreference extends DialogPreference
|
|||
}
|
||||
}
|
||||
|
||||
assert passwordInput.getText() != null; // The save button should only be accessible when a password has been entered (and confirmed)
|
||||
ChangeCredentialsTask task = new ChangeCredentialsTask(context, encryptionType, oldEncryptionKey, value, passwordInput.getText().toString());
|
||||
task.setCallback(this::handleTaskResult);
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ public class ChangeCredentialsTask extends UiBasedBackgroundTask<ChangeCredentia
|
|||
return new Result(false, null, null);
|
||||
}
|
||||
|
||||
// We already persist the new value here so if something happens to the calling preference
|
||||
// everything is already finalized
|
||||
settings.setAuthMethod(newAuthMethod);
|
||||
|
||||
return new Result(true, newEncryptionKey, encryptionType);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue