From 1cd24562917ff882b74cca8e56c10bd9faa89b8d Mon Sep 17 00:00:00 2001 From: lhwdev Date: Sat, 26 Dec 2020 20:22:11 +0900 Subject: [PATCH] Fixed bug: cannot cancel scheduling --- app/build.gradle | 4 ++-- app/src/main/java/com/lhwdev/selfTestMacro/MainActivity.kt | 2 +- app/src/main/java/com/lhwdev/selfTestMacro/selfTestUtils.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f4dd7b9b..d28b95f0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId "com.lhwdev.selfTestMacro" minSdkVersion 19 targetSdkVersion 30 - versionCode 1008 - versionName "2.8" + versionCode 1009 + versionName "2.9" multiDexEnabled true diff --git a/app/src/main/java/com/lhwdev/selfTestMacro/MainActivity.kt b/app/src/main/java/com/lhwdev/selfTestMacro/MainActivity.kt index a5b4b75d..b2e55f50 100644 --- a/app/src/main/java/com/lhwdev/selfTestMacro/MainActivity.kt +++ b/app/src/main/java/com/lhwdev/selfTestMacro/MainActivity.kt @@ -95,10 +95,10 @@ class MainActivity : AppCompatActivity() { if(isSchedulingEnabled) { @SuppressLint("SetTextI18n") time.text = "매일 자가진단: ${pref.hour}시 ${pref.min}분" - updateTime(intent) } else { time.text = "시간 예약 안 됨" } + updateTime(intent) } fun pickTime() { diff --git a/app/src/main/java/com/lhwdev/selfTestMacro/selfTestUtils.kt b/app/src/main/java/com/lhwdev/selfTestMacro/selfTestUtils.kt index 5f905041..04fe9e90 100644 --- a/app/src/main/java/com/lhwdev/selfTestMacro/selfTestUtils.kt +++ b/app/src/main/java/com/lhwdev/selfTestMacro/selfTestUtils.kt @@ -44,7 +44,7 @@ suspend fun Context.submitSuspend(notification: Boolean = true) { fun Context.updateTime(intent: PendingIntent) { val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager alarmManager.cancel(intent) - if(preferenceState.hour != -1) + if(preferenceState.isSchedulingEnabled) scheduleNextAlarm(intent, preferenceState.hour, preferenceState.min) }