From 1936b8e41fc7e32c669c7f0f44d2a3ce35f2bee0 Mon Sep 17 00:00:00 2001 From: Erik Eelde Date: Tue, 8 May 2018 23:16:20 +0200 Subject: [PATCH 1/2] Wrench LiveData moved from sample app to its own module --- build.gradle | 4 ++-- wrench-app/build.gradle | 16 ++++++++-------- wrench-sample/build.gradle | 12 ++++++------ .../wrench/preferences/PreferencesTest.java | 5 +++-- wrench-service/build.gradle | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index fe5c185..c97546b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.31' + ext.kotlin_version = '1.2.41' repositories { jcenter() google() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0-alpha11' + classpath 'com.android.tools.build:gradle:3.2.0-alpha14' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/wrench-app/build.gradle b/wrench-app/build.gradle index 9676dd8..f3cd5c1 100644 --- a/wrench-app/build.gradle +++ b/wrench-app/build.gradle @@ -62,14 +62,14 @@ android { dependencies { testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2-beta1' - androidTestImplementation 'com.android.support.test:runner:1.0.2-beta1' - androidTestImplementation 'android.arch.persistence.room:testing:1.1.0-beta2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'android.arch.persistence.room:testing:1.1.0' annotationProcessor "android.arch.lifecycle:compiler:1.1.1" - annotationProcessor "android.arch.persistence.room:compiler:1.1.0-beta2" + annotationProcessor "android.arch.persistence.room:compiler:1.1.0" annotationProcessor "com.google.dagger:dagger-android-processor:2.15" - annotationProcessor "com.google.dagger:dagger-compiler:2.15" + annotationProcessor "com.google.dagger:dagger-compiler:2.16" implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:recyclerview-v7:27.1.1' @@ -78,10 +78,10 @@ dependencies { implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'com.android.support:cardview-v7:27.1.1' implementation 'android.arch.lifecycle:extensions:1.1.1' - implementation 'android.arch.persistence.room:runtime:1.1.0-beta2' - implementation "android.arch.paging:runtime:1.0.0-beta1" + implementation 'android.arch.persistence.room:runtime:1.1.0' + implementation "android.arch.paging:runtime:1.0.0" - implementation "com.google.dagger:dagger:2.15" + implementation "com.google.dagger:dagger:2.16" implementation "com.google.dagger:dagger-android:2.15" implementation "com.google.dagger:dagger-android-support:2.15" diff --git a/wrench-sample/build.gradle b/wrench-sample/build.gradle index 2bac004..065b006 100644 --- a/wrench-sample/build.gradle +++ b/wrench-sample/build.gradle @@ -45,14 +45,14 @@ android { dependencies { kapt "com.google.dagger:dagger-android-processor:2.15" - kapt "com.google.dagger:dagger-compiler:2.15" + kapt "com.google.dagger:dagger-compiler:2.16" testImplementation 'junit:junit:4.12' - testImplementation 'org.mockito:mockito-core:2.18.0' + testImplementation 'org.mockito:mockito-core:2.18.3' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2-beta1' - androidTestImplementation 'com.android.support.test:runner:1.0.2-beta1' - androidTestImplementation 'com.android.support.test:rules:1.0.2-beta1' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test:rules:1.0.2' androidTestImplementation project(":wrench-core") androidTestImplementation project(":wrench-prefs") @@ -62,7 +62,7 @@ dependencies { implementation 'com.android.support.constraint:constraint-layout:1.1.0' implementation 'android.arch.lifecycle:extensions:1.1.1' - implementation "com.google.dagger:dagger:2.15" + implementation "com.google.dagger:dagger:2.16" implementation "com.google.dagger:dagger-android:2.15" implementation "com.google.dagger:dagger-android-support:2.15" diff --git a/wrench-sample/src/androidTest/java/com/example/wrench/preferences/PreferencesTest.java b/wrench-sample/src/androidTest/java/com/example/wrench/preferences/PreferencesTest.java index 742c222..5a8178c 100644 --- a/wrench-sample/src/androidTest/java/com/example/wrench/preferences/PreferencesTest.java +++ b/wrench-sample/src/androidTest/java/com/example/wrench/preferences/PreferencesTest.java @@ -24,6 +24,7 @@ import org.junit.runner.RunWith; import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertFalse; @RunWith(AndroidJUnit4.class) public class PreferencesTest { @@ -39,8 +40,8 @@ public void setUp() { public void checkBoolean() { String key = "boolean"; WrenchPreferences wrenchPreferences = new WrenchPreferences(mockContext); - assertEquals(false, wrenchPreferences.getBoolean(key, false)); - assertEquals(false, wrenchPreferences.getBoolean(key, true)); + assertFalse(wrenchPreferences.getBoolean(key, false)); + assertFalse(wrenchPreferences.getBoolean(key, true)); } @Test diff --git a/wrench-service/build.gradle b/wrench-service/build.gradle index b019435..d74d090 100644 --- a/wrench-service/build.gradle +++ b/wrench-service/build.gradle @@ -31,7 +31,7 @@ dependencies { implementation project(":wrench-core") testImplementation 'junit:junit:4.12' implementation 'com.android.support:support-annotations:27.1.1' - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } apply from: rootProject.file('gradle/gradle-mvn-push.gradle') \ No newline at end of file From 8658b15dd67dfcb62944c7a0c4a09d96628d8577 Mon Sep 17 00:00:00 2001 From: Erik Eelde Date: Tue, 8 May 2018 23:42:18 +0200 Subject: [PATCH 2/2] Bah --- .../src/main/java/com/izettle/wrench/service/WrenchService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wrench-service/src/main/java/com/izettle/wrench/service/WrenchService.kt b/wrench-service/src/main/java/com/izettle/wrench/service/WrenchService.kt index 19f5a3e..1e0d923 100644 --- a/wrench-service/src/main/java/com/izettle/wrench/service/WrenchService.kt +++ b/wrench-service/src/main/java/com/izettle/wrench/service/WrenchService.kt @@ -1,5 +1,6 @@ package com.izettle.wrench.service +import android.annotation.SuppressLint import android.app.IntentService import android.content.ContentResolver import android.content.Intent @@ -70,6 +71,7 @@ class WrenchService : IntentService("WrenchService") { contentResolver.update(WrenchProviderContract.boltUri(bolt.id), bolt.toContentValues(), null, null) } + @SuppressLint("Recycle") private fun getBolt(contentResolver: ContentResolver, @Bolt.BoltType boltType: String, key: String): Bolt? { val cursor = contentResolver.query(WrenchProviderContract.boltUri(key), null, null, null, null) cursor.use {