Skip to content

Commit

Permalink
Merge pull request #505 from pudup/master
Browse files Browse the repository at this point in the history
Fix #502
  • Loading branch information
tibbi authored Sep 5, 2023
2 parents 35132e7 + a75dce8 commit 149c072
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.simplemobiletools.clock.R
import com.simplemobiletools.clock.databinding.ActivityReminderBinding
import com.simplemobiletools.clock.extensions.*
import com.simplemobiletools.clock.helpers.ALARM_ID
import com.simplemobiletools.clock.helpers.ALARM_NOTIF_ID
import com.simplemobiletools.clock.helpers.getPassedSeconds
import com.simplemobiletools.clock.models.Alarm
import com.simplemobiletools.commons.extensions.*
Expand All @@ -40,6 +41,7 @@ class ReminderActivity : SimpleActivity() {
private var initialAlarmVolume: Int? = null
private var dragDownX = 0f
private val binding: ActivityReminderBinding by viewBinding(ActivityReminderBinding::inflate)
private var finished = false

override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
Expand Down Expand Up @@ -239,7 +241,12 @@ class ReminderActivity : SimpleActivity() {
maxReminderDurationHandler.removeCallbacksAndMessages(null)
swipeGuideFadeHandler.removeCallbacksAndMessages(null)
vibrationHandler.removeCallbacksAndMessages(null)
destroyEffects()
if (!finished) {
finishActivity()
notificationManager.cancel(ALARM_NOTIF_ID)
} else {
destroyEffects()
}
}

private fun destroyEffects() {
Expand Down Expand Up @@ -291,6 +298,7 @@ class ReminderActivity : SimpleActivity() {
}
}

finished = true
destroyEffects()
finish()
overridePendingTransition(0, 0)
Expand Down

0 comments on commit 149c072

Please sign in to comment.