Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #502 #503

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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 @@ -39,6 +40,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 @@ -229,7 +231,13 @@ 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 @@ -265,6 +273,7 @@ class ReminderActivity : SimpleActivity() {
scheduleNextAlarm(alarm!!, false)
}

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