From 1a720c82e9a01118608e367ea6747eaae7116c61 Mon Sep 17 00:00:00 2001 From: atsuko-fukui Date: Tue, 9 Nov 2021 14:27:40 +0900 Subject: [PATCH 1/4] Android 12 --- debot-no-op/build.gradle | 4 ++-- debot-sample/build.gradle | 4 ++-- debot-sample/src/main/AndroidManifest.xml | 1 + .../java/com/tomoima/debot/sample/activity/BaseActivity.java | 3 ++- debot/build.gradle | 4 ++-- debot/src/main/java/com/tomoima/debot/Debot.kt | 4 ++-- dependencies.gradle | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/debot-no-op/build.gradle b/debot-no-op/build.gradle index 769884c..7cad1d3 100644 --- a/debot-no-op/build.gradle +++ b/debot-no-op/build.gradle @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android' apply plugin: 'maven-publish' android { - compileSdkVersion 30 + compileSdkVersion 31 defaultConfig { minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 31 versionCode 1 versionName "1.0" } diff --git a/debot-sample/build.gradle b/debot-sample/build.gradle index 03c72f3..ba8b93c 100644 --- a/debot-sample/build.gradle +++ b/debot-sample/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 31 defaultConfig { applicationId "com.tomoima.debot.sample" minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 31 versionCode 1 versionName "1.0" } diff --git a/debot-sample/src/main/AndroidManifest.xml b/debot-sample/src/main/AndroidManifest.xml index d4366ba..4774cd5 100644 --- a/debot-sample/src/main/AndroidManifest.xml +++ b/debot-sample/src/main/AndroidManifest.xml @@ -14,6 +14,7 @@ android:theme="@style/AppTheme" > diff --git a/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java b/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java index fd1ad1f..007af5e 100644 --- a/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java +++ b/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java @@ -1,5 +1,6 @@ package com.tomoima.debot.sample.activity; +import android.hardware.SensorManager; import android.os.Bundle; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -21,7 +22,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { @Override protected void onResume() { super.onResume(); - debot.startSensor(this); + debot.startSensor(this, SensorManager.SENSOR_DELAY_GAME); } @Override diff --git a/debot/build.gradle b/debot/build.gradle index c87bfd2..02a155e 100644 --- a/debot/build.gradle +++ b/debot/build.gradle @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android' apply plugin: 'maven-publish' android { - compileSdkVersion 30 + compileSdkVersion 31 defaultConfig { minSdkVersion 16 - targetSdkVersion 29 + targetSdkVersion 31 versionCode 1 versionName "1.0" testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' diff --git a/debot/src/main/java/com/tomoima/debot/Debot.kt b/debot/src/main/java/com/tomoima/debot/Debot.kt index bd6b8aa..dc79150 100644 --- a/debot/src/main/java/com/tomoima/debot/Debot.kt +++ b/debot/src/main/java/com/tomoima/debot/Debot.kt @@ -20,10 +20,10 @@ class Debot private constructor() { setupSensor(context) } - fun startSensor(activity: FragmentActivity) { + fun startSensor(activity: FragmentActivity, sensorDelay: Int) { if (!canShake) return activityWeakRef = WeakReference(activity) - sd?.start(sensorManager) + sd?.start(sensorManager, sensorDelay) } fun stopSensor() { diff --git a/dependencies.gradle b/dependencies.gradle index 8128703..a45096f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ ext.versions = [ supportLibrary : '27.1.0', androidKtx : '0.2', - seismic : '1.0.2', + seismic : '1.0.3', junit : '4.12', testRunner: '1.0.1', espressoCore : '3.0.1', From 91a87c89e378d9afe7f70a4246a67bc83ce63fd3 Mon Sep 17 00:00:00 2001 From: atsuko-fukui Date: Tue, 9 Nov 2021 16:24:51 +0900 Subject: [PATCH 2/4] add parameter to startSensor of no-ops --- debot-no-op/src/main/java/com/tomoima/debot/Debot.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt b/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt index 4370fa9..b9b7752 100644 --- a/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt +++ b/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt @@ -8,7 +8,7 @@ class Debot private constructor()//Do nothing fun allowShake(context: Context) {} - fun startSensor(activity: FragmentActivity) {} + fun startSensor(activity: FragmentActivity, sensorDelay: Int) {} fun stopSensor() {} From c66ca11caac7119a0aa7608ae3d59056ace6100d Mon Sep 17 00:00:00 2001 From: atsuko-fukui Date: Tue, 9 Nov 2021 20:21:05 +0900 Subject: [PATCH 3/4] keep old functions to avoid breaking change --- debot-no-op/src/main/java/com/tomoima/debot/Debot.kt | 3 ++- debot/src/main/java/com/tomoima/debot/Debot.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt b/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt index b9b7752..e214a58 100644 --- a/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt +++ b/debot-no-op/src/main/java/com/tomoima/debot/Debot.kt @@ -8,7 +8,8 @@ class Debot private constructor()//Do nothing fun allowShake(context: Context) {} - fun startSensor(activity: FragmentActivity, sensorDelay: Int) {} + @JvmOverloads + fun startSensor(activity: FragmentActivity, sensorDelay: Int = 0) {} fun stopSensor() {} diff --git a/debot/src/main/java/com/tomoima/debot/Debot.kt b/debot/src/main/java/com/tomoima/debot/Debot.kt index dc79150..03f4338 100644 --- a/debot/src/main/java/com/tomoima/debot/Debot.kt +++ b/debot/src/main/java/com/tomoima/debot/Debot.kt @@ -20,7 +20,8 @@ class Debot private constructor() { setupSensor(context) } - fun startSensor(activity: FragmentActivity, sensorDelay: Int) { + @JvmOverloads + fun startSensor(activity: FragmentActivity, sensorDelay: Int = 0) { if (!canShake) return activityWeakRef = WeakReference(activity) sd?.start(sensorManager, sensorDelay) From 476286170e203808cbb06cee1ea9ffa3dcd645ad Mon Sep 17 00:00:00 2001 From: atsuko-fukui Date: Tue, 9 Nov 2021 20:57:13 +0900 Subject: [PATCH 4/4] use SENSOR_DELAY_GAME as a default parameter --- .../java/com/tomoima/debot/sample/activity/BaseActivity.java | 2 +- debot/src/main/java/com/tomoima/debot/Debot.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java b/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java index 007af5e..f4ec237 100644 --- a/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java +++ b/debot-sample/src/main/java/com/tomoima/debot/sample/activity/BaseActivity.java @@ -22,7 +22,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { @Override protected void onResume() { super.onResume(); - debot.startSensor(this, SensorManager.SENSOR_DELAY_GAME); + debot.startSensor(this); } @Override diff --git a/debot/src/main/java/com/tomoima/debot/Debot.kt b/debot/src/main/java/com/tomoima/debot/Debot.kt index 03f4338..29b9827 100644 --- a/debot/src/main/java/com/tomoima/debot/Debot.kt +++ b/debot/src/main/java/com/tomoima/debot/Debot.kt @@ -21,7 +21,7 @@ class Debot private constructor() { } @JvmOverloads - fun startSensor(activity: FragmentActivity, sensorDelay: Int = 0) { + fun startSensor(activity: FragmentActivity, sensorDelay: Int = SensorManager.SENSOR_DELAY_GAME) { if (!canShake) return activityWeakRef = WeakReference(activity) sd?.start(sensorManager, sensorDelay)