mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
Avoid shifting start, end times when switching calendars
This commit is contained in:
@@ -1306,6 +1306,9 @@ class EventActivity : SimpleActivity() {
|
|||||||
|
|
||||||
// recreate the event if it was moved in a different CalDAV calendar
|
// recreate the event if it was moved in a different CalDAV calendar
|
||||||
if (mEvent.id != null && oldSource != newSource && oldSource != SOURCE_IMPORTED_ICS) {
|
if (mEvent.id != null && oldSource != newSource && oldSource != SOURCE_IMPORTED_ICS) {
|
||||||
|
if (mRepeatInterval > 0 && wasRepeatable) {
|
||||||
|
applyOriginalStartEndTimes()
|
||||||
|
}
|
||||||
eventsHelper.deleteEvent(mEvent.id!!, true)
|
eventsHelper.deleteEvent(mEvent.id!!, true)
|
||||||
mEvent.id = null
|
mEvent.id = null
|
||||||
}
|
}
|
||||||
@@ -1386,8 +1389,19 @@ class EventActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
EDIT_ALL_OCCURRENCES -> {
|
EDIT_ALL_OCCURRENCES -> {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
|
applyOriginalStartEndTimes()
|
||||||
|
eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun applyOriginalStartEndTimes() {
|
||||||
// Shift the start and end times of the first (original) event based on the changes made
|
// Shift the start and end times of the first (original) event based on the changes made
|
||||||
val originalEvent = eventsDB.getEventWithId(mEvent.id!!) ?: return@ensureBackgroundThread
|
val originalEvent = eventsDB.getEventWithId(mEvent.id!!) ?: return
|
||||||
val originalStartTS = originalEvent.startTS
|
val originalStartTS = originalEvent.startTS
|
||||||
val originalEndTS = originalEvent.endTS
|
val originalEndTS = originalEvent.endTS
|
||||||
val oldStartTS = mOriginalStartTS
|
val oldStartTS = mOriginalStartTS
|
||||||
@@ -1399,13 +1413,6 @@ class EventActivity : SimpleActivity() {
|
|||||||
startTS = originalStartTS - startTSDelta
|
startTS = originalStartTS - startTSDelta
|
||||||
endTS = originalEndTS - endTSDelta
|
endTS = originalEndTS - endTSDelta
|
||||||
}
|
}
|
||||||
eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) {
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateStartTexts() {
|
private fun updateStartTexts() {
|
||||||
|
Reference in New Issue
Block a user