Search in sources :

Example 1 with Person

use of sqlite.feature.typeadapter.bitmap.Person in project kripton by xcesco.

the class TestFeatureSQLTypeAdapterBitmapRuntime method testSelect.

@Test
public void testSelect() {
    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inPreferredConfig = Bitmap.Config.ARGB_8888;
    final Bitmap bitmap = BitmapFactory.decodeFile("/src/test/resources/imgs/img.png", options);
    BindAppDataSource ds = BindAppDataSource.instance();
    ds.execute(new Transaction() {

        @Override
        public TransactionResult onExecute(BindAppDaoFactory daoFactory) {
            Person bean = new Person();
            bean.image = bitmap;
            daoFactory.getDaoPerson().insert(bean);
            List<Person> list = daoFactory.getDaoPerson().list();
            for (Person person : list) {
                // use
                saveImage((new File("src/test/resources/imgs/img0.png")).getAbsolutePath(), person.image);
            }
            return TransactionResult.COMMIT;
        }
    });
}
Also used : Bitmap(android.graphics.Bitmap) TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) Transaction(sqlite.feature.typeadapter.bitmap.BindAppDataSource.Transaction) BindAppDataSource(sqlite.feature.typeadapter.bitmap.BindAppDataSource) BindAppDaoFactory(sqlite.feature.typeadapter.bitmap.BindAppDaoFactory) List(java.util.List) BitmapFactory(android.graphics.BitmapFactory) Person(sqlite.feature.typeadapter.bitmap.Person) File(java.io.File) Test(org.junit.Test) BaseAndroidTest(base.BaseAndroidTest)

Aggregations

Bitmap (android.graphics.Bitmap)1 BitmapFactory (android.graphics.BitmapFactory)1 BaseAndroidTest (base.BaseAndroidTest)1 TransactionResult (com.abubusoft.kripton.android.sqlite.TransactionResult)1 File (java.io.File)1 List (java.util.List)1 Test (org.junit.Test)1 BindAppDaoFactory (sqlite.feature.typeadapter.bitmap.BindAppDaoFactory)1 BindAppDataSource (sqlite.feature.typeadapter.bitmap.BindAppDataSource)1 Transaction (sqlite.feature.typeadapter.bitmap.BindAppDataSource.Transaction)1 Person (sqlite.feature.typeadapter.bitmap.Person)1