use of com.keepassdroid.database.edit.SaveDB in project KeePassDX by Kunzisoft.
the class RoundsPreferenceDialogFragmentCompat method onDialogClosed.
@Override
public void onDialogClosed(boolean positiveResult) {
if (positiveResult) {
long rounds;
try {
String strRounds = mRoundsView.getText().toString();
rounds = Long.parseLong(strRounds);
} catch (NumberFormatException e) {
Toast.makeText(getContext(), R.string.error_rounds_not_number, Toast.LENGTH_LONG).show();
return;
}
if (rounds < 1) {
rounds = 1;
}
long oldRounds = mPM.getNumRounds();
try {
mPM.setNumRounds(rounds);
} catch (NumberFormatException e) {
Toast.makeText(getContext(), R.string.error_rounds_too_large, Toast.LENGTH_LONG).show();
mPM.setNumRounds(Integer.MAX_VALUE);
}
Handler handler = new Handler();
SaveDB save = new SaveDB(getContext(), App.getDB(), new AfterSave(getContext(), handler, oldRounds));
ProgressTask pt = new ProgressTask(getContext(), save, R.string.saving_database);
pt.run();
}
}
Aggregations