Search in sources :

Example 1 with SaveDB

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();
    }
}
Also used : ProgressTask(com.keepassdroid.tasks.ProgressTask) Handler(android.os.Handler) SaveDB(com.keepassdroid.database.edit.SaveDB)

Aggregations

Handler (android.os.Handler)1 SaveDB (com.keepassdroid.database.edit.SaveDB)1 ProgressTask (com.keepassdroid.tasks.ProgressTask)1