Search in sources :

Example 11 with Database

use of com.keepassdroid.database.Database in project KeePassDX by Kunzisoft.

the class TestData method GetDb.

public static Database GetDb(Context ctx, String asset, String password, String keyfile, String filename) throws Exception {
    AssetManager am = ctx.getAssets();
    InputStream is = am.open(asset, AssetManager.ACCESS_STREAMING);
    Database Db = new Database();
    InputStream keyIs = TestUtil.getKeyFileInputStream(ctx, keyfile);
    Db.LoadData(ctx, is, password, keyIs, Importer.DEBUG);
    Uri.Builder b = new Uri.Builder();
    Db.mUri = b.scheme("file").path(filename).build();
    return Db;
}
Also used : AssetManager(android.content.res.AssetManager) InputStream(java.io.InputStream) Database(com.keepassdroid.database.Database) Uri(android.net.Uri)

Aggregations

Database (com.keepassdroid.database.Database)11 PwDatabase (com.keepassdroid.database.PwDatabase)6 Intent (android.content.Intent)3 PwGroup (com.keepassdroid.database.PwGroup)3 Uri (android.net.Uri)2 Preference (android.support.v7.preference.Preference)2 Toolbar (android.support.v7.widget.Toolbar)2 View (android.view.View)2 PwGroupId (com.keepassdroid.database.PwGroupId)2 ProgressTask (com.keepassdroid.tasks.ProgressTask)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 AssetManager (android.content.res.AssetManager)1 Resources (android.content.res.Resources)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Settings (android.provider.Settings)1 RequiresApi (android.support.annotation.RequiresApi)1