show the Save/Discard dialog properly at repeating events
This commit is contained in:
parent
3ff61c7206
commit
7ceb9dc463
|
@ -88,6 +88,8 @@ class EventActivity : SimpleActivity() {
|
||||||
private var mSelectedContacts = ArrayList<Attendee>()
|
private var mSelectedContacts = ArrayList<Attendee>()
|
||||||
private var mStoredEventTypes = ArrayList<EventType>()
|
private var mStoredEventTypes = ArrayList<EventType>()
|
||||||
private var mOriginalTimeZone = DateTimeZone.getDefault().id
|
private var mOriginalTimeZone = DateTimeZone.getDefault().id
|
||||||
|
private var mOriginalStartTS = 0L
|
||||||
|
private var mOriginalEndTS = 0L
|
||||||
|
|
||||||
private lateinit var mEventStartDateTime: DateTime
|
private lateinit var mEventStartDateTime: DateTime
|
||||||
private lateinit var mEventEndDateTime: DateTime
|
private lateinit var mEventEndDateTime: DateTime
|
||||||
|
@ -278,17 +280,22 @@ class EventActivity : SimpleActivity() {
|
||||||
newEndTS = second
|
newEndTS = second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hasTimeChanged = if (mOriginalStartTS == 0L) {
|
||||||
|
mEvent.startTS != newStartTS || mEvent.endTS != newEndTS
|
||||||
|
} else {
|
||||||
|
mOriginalStartTS != newStartTS || mOriginalEndTS != newEndTS
|
||||||
|
}
|
||||||
|
|
||||||
val reminders = getReminders()
|
val reminders = getReminders()
|
||||||
if (event_title.value != mEvent.title ||
|
if (event_title.value != mEvent.title ||
|
||||||
event_location.value != mEvent.location ||
|
event_location.value != mEvent.location ||
|
||||||
event_description.value != mEvent.description ||
|
event_description.value != mEvent.description ||
|
||||||
newStartTS != mEvent.startTS ||
|
|
||||||
newEndTS != mEvent.endTS ||
|
|
||||||
event_time_zone.text != mEvent.getTimeZoneString() ||
|
event_time_zone.text != mEvent.getTimeZoneString() ||
|
||||||
reminders != mEvent.getReminders() ||
|
reminders != mEvent.getReminders() ||
|
||||||
mRepeatInterval != mEvent.repeatInterval ||
|
mRepeatInterval != mEvent.repeatInterval ||
|
||||||
mRepeatRule != mEvent.repeatRule ||
|
mRepeatRule != mEvent.repeatRule ||
|
||||||
mEventTypeId != mEvent.eventType) {
|
mEventTypeId != mEvent.eventType ||
|
||||||
|
hasTimeChanged) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,6 +408,9 @@ class EventActivity : SimpleActivity() {
|
||||||
private fun setupEditEvent() {
|
private fun setupEditEvent() {
|
||||||
val realStart = if (mEventOccurrenceTS == 0L) mEvent.startTS else mEventOccurrenceTS
|
val realStart = if (mEventOccurrenceTS == 0L) mEvent.startTS else mEventOccurrenceTS
|
||||||
val duration = mEvent.endTS - mEvent.startTS
|
val duration = mEvent.endTS - mEvent.startTS
|
||||||
|
mOriginalStartTS = realStart
|
||||||
|
mOriginalEndTS = realStart + duration
|
||||||
|
|
||||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
||||||
updateActionBarTitle(getString(R.string.edit_event))
|
updateActionBarTitle(getString(R.string.edit_event))
|
||||||
mOriginalTimeZone = mEvent.timeZone
|
mOriginalTimeZone = mEvent.timeZone
|
||||||
|
|
Loading…
Reference in New Issue