From 451229779f1a98e2b76388e04345a5a4896a4f27 Mon Sep 17 00:00:00 2001 From: torrentcome Date: Wed, 5 Jul 2017 16:34:59 +0200 Subject: [PATCH] (room) add room gradle file --- app/build.gradle | 3 +++ .../java/com/keylesspalace/tusky/TuskyApplication.java | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 69dae6286..6a0789183 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -54,7 +54,10 @@ dependencies { exclude module: 'support-v4' } testCompile 'junit:junit:4.12' + + //room compile "android.arch.persistence.room:runtime:1.0.0-alpha3" annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha3" + compile "android.arch.persistence.room:rxjava2:1.0.0-alpha2" } diff --git a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java index 877473fed..3a1b0b44c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java +++ b/app/src/main/java/com/keylesspalace/tusky/TuskyApplication.java @@ -28,6 +28,10 @@ public class TuskyApplication extends Application { private static AppDatabase db; + public static AppDatabase getDB() { + return db; + } + @Override public void onCreate() { super.onCreate(); @@ -54,10 +58,6 @@ public class TuskyApplication extends Application { } db = Room.databaseBuilder(getApplicationContext(), - AppDatabase.class, "tuskyDB").build(); - } - - public static AppDatabase getDB() { - return db; + AppDatabase.class, "tuskyDB").allowMainThreadQueries().build(); } } \ No newline at end of file