From 35d60d802759dc02ade310851077198fcf8bc779 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Sep 2020 15:53:52 +0200 Subject: [PATCH] allow exiting the Event screen with unsaved changes by spamming Back --- .../calendar/pro/activities/EventActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index 050228825..12a71fe2d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -79,6 +79,7 @@ class EventActivity : SimpleActivity() { private var mEventTypeId = REGULAR_EVENT_TYPE_ID private var mDialogTheme = 0 private var mEventOccurrenceTS = 0L + private var mLastSavePromptTS = 0L private var mEventCalendarId = STORED_LOCALLY_ONLY private var mWasActivityInitialized = false private var mWasContactsPermissionChecked = false @@ -303,7 +304,8 @@ class EventActivity : SimpleActivity() { } override fun onBackPressed() { - if (isEventChanged()) { + if (isEventChanged() && System.currentTimeMillis() - mLastSavePromptTS > SAVE_DISCARD_PROMPT_INTERVAL) { + mLastSavePromptTS = System.currentTimeMillis() ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) { if (it) { saveCurrentEvent()