mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
allow exiting the Event screen with unsaved changes by spamming Back
This commit is contained in:
parent
f5a602863f
commit
35d60d8027
@ -79,6 +79,7 @@ class EventActivity : SimpleActivity() {
|
|||||||
private var mEventTypeId = REGULAR_EVENT_TYPE_ID
|
private var mEventTypeId = REGULAR_EVENT_TYPE_ID
|
||||||
private var mDialogTheme = 0
|
private var mDialogTheme = 0
|
||||||
private var mEventOccurrenceTS = 0L
|
private var mEventOccurrenceTS = 0L
|
||||||
|
private var mLastSavePromptTS = 0L
|
||||||
private var mEventCalendarId = STORED_LOCALLY_ONLY
|
private var mEventCalendarId = STORED_LOCALLY_ONLY
|
||||||
private var mWasActivityInitialized = false
|
private var mWasActivityInitialized = false
|
||||||
private var mWasContactsPermissionChecked = false
|
private var mWasContactsPermissionChecked = false
|
||||||
@ -303,7 +304,8 @@ class EventActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
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) {
|
ConfirmationAdvancedDialog(this, "", R.string.save_before_closing, R.string.save, R.string.discard) {
|
||||||
if (it) {
|
if (it) {
|
||||||
saveCurrentEvent()
|
saveCurrentEvent()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user