Search in sources :

Example 1 with CreateDB

use of com.keepassdroid.database.edit.CreateDB 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());
    }
}
Also used : CreateDB(com.keepassdroid.database.edit.CreateDB) ProgressTask(com.keepassdroid.tasks.ProgressTask) AssignPasswordHelper(com.keepassdroid.password.AssignPasswordHelper) FileOnFinish(com.keepassdroid.database.edit.FileOnFinish) FileNotFoundException(java.io.FileNotFoundException) ContentFileNotFoundException(com.keepassdroid.database.exception.ContentFileNotFoundException) IOException(java.io.IOException)

Aggregations

CreateDB (com.keepassdroid.database.edit.CreateDB)1 FileOnFinish (com.keepassdroid.database.edit.FileOnFinish)1 ContentFileNotFoundException (com.keepassdroid.database.exception.ContentFileNotFoundException)1 AssignPasswordHelper (com.keepassdroid.password.AssignPasswordHelper)1 ProgressTask (com.keepassdroid.tasks.ProgressTask)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1