use of com.keepassdroid.tasks.ProgressTask in project KeePassDX by Kunzisoft.
the class GroupActivity method approveEditGroup.
@Override
public void approveEditGroup(Bundle bundle) {
String GroupName = bundle.getString(GroupEditDialogFragment.KEY_NAME);
int GroupIconID = bundle.getInt(GroupEditDialogFragment.KEY_ICON_ID);
switch(editGroupDialogAction) {
case CREATION:
// If edit group creation
Handler handler = new Handler();
AddGroup task = new AddGroup(this, App.getDB(), GroupName, GroupIconID, mCurrentGroup, new AfterAddNode(handler), false);
ProgressTask pt = new ProgressTask(this, task, R.string.saving_database);
pt.run();
break;
case UPDATE:
// TODO UpdateGroup
break;
}
editGroupDialogAction = EditGroupDialogAction.NONE;
}
use of com.keepassdroid.tasks.ProgressTask in project KeePassDX by Kunzisoft.
the class GroupActivity method deleteGroup.
private void deleteGroup(PwGroup group) {
// TODO Verify trash recycle bin
Handler handler = new Handler();
DeleteGroup task = new DeleteGroup(this, App.getDB(), group, new AfterDeleteNode(handler, group));
ProgressTask pt = new ProgressTask(this, task, R.string.saving_database);
pt.run();
}
use of com.keepassdroid.tasks.ProgressTask 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();
}
}
use of com.keepassdroid.tasks.ProgressTask in project KeePassDX by Kunzisoft.
the class FileSelectActivity method onAssignKeyDialogPositiveClick.
@Override
public void onAssignKeyDialogPositiveClick(boolean masterPasswordChecked, String masterPassword, boolean keyFileChecked, Uri keyFile) {
try {
String databaseFilename = databaseUri.getPath();
// Prep an object to collect a password once the database has
// been created
FileOnFinish launchActivityOnFinish = new FileOnFinish(new LaunchGroupActivity(databaseFilename));
AssignPasswordOnFinish assignPasswordOnFinish = new AssignPasswordOnFinish(launchActivityOnFinish);
// Create the new database
CreateDB create = new CreateDB(FileSelectActivity.this, databaseFilename, assignPasswordOnFinish, true);
ProgressTask createTask = new ProgressTask(FileSelectActivity.this, create, R.string.progress_create);
createTask.run();
assignPasswordHelper = new AssignPasswordHelper(this, masterPassword, keyFile);
} catch (Exception e) {
String error = "Unable to create database with this password and key file";
Toast.makeText(this, error, Toast.LENGTH_LONG).show();
Log.e(TAG, error + " " + e.getMessage());
}
}
use of com.keepassdroid.tasks.ProgressTask in project KeePassDX by Kunzisoft.
the class AssignPasswordHelper method assignPasswordInDatabase.
public void assignPasswordInDatabase(FileOnFinish fileOnFinish) {
SetPassword sp = new SetPassword(context, App.getDB(), masterPassword, keyfile, new AfterSave(fileOnFinish, new Handler()));
final ProgressTask pt = new ProgressTask(context, sp, R.string.saving_database);
boolean valid = sp.validatePassword(context, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
pt.run();
}
});
if (valid) {
pt.run();
}
}
Aggregations