mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
Merge pull request #1862 from Naveen3Singh/all_day_fixes
All-day event timezone fixes
This commit is contained in:
@@ -224,9 +224,14 @@ class EventActivity : SimpleActivity() {
|
|||||||
updateTextColors(event_scrollview)
|
updateTextColors(event_scrollview)
|
||||||
updateIconColors()
|
updateIconColors()
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
event_time_zone_divider.beVisibleIf(config.allowChangingTimeZones)
|
showOrHideTimeZone()
|
||||||
event_time_zone_image.beVisibleIf(config.allowChangingTimeZones)
|
}
|
||||||
event_time_zone.beVisibleIf(config.allowChangingTimeZones)
|
|
||||||
|
private fun showOrHideTimeZone() {
|
||||||
|
val allowChangingTimeZones = config.allowChangingTimeZones && !event_all_day.isChecked
|
||||||
|
event_time_zone_divider.beVisibleIf(allowChangingTimeZones)
|
||||||
|
event_time_zone_image.beVisibleIf(allowChangingTimeZones)
|
||||||
|
event_time_zone.beVisibleIf(allowChangingTimeZones)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun refreshMenuItems() {
|
private fun refreshMenuItems() {
|
||||||
@@ -998,6 +1003,9 @@ class EventActivity : SimpleActivity() {
|
|||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
event_start_time.beGoneIf(isChecked)
|
event_start_time.beGoneIf(isChecked)
|
||||||
event_end_time.beGoneIf(isChecked)
|
event_end_time.beGoneIf(isChecked)
|
||||||
|
mEvent.timeZone = if (isChecked) DateTimeZone.UTC.id else DateTimeZone.getDefault().id
|
||||||
|
updateTimeZoneText()
|
||||||
|
showOrHideTimeZone()
|
||||||
resetTime()
|
resetTime()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,7 +1157,11 @@ class EventActivity : SimpleActivity() {
|
|||||||
reminder3Type = mReminder3Type
|
reminder3Type = mReminder3Type
|
||||||
repeatInterval = mRepeatInterval
|
repeatInterval = mRepeatInterval
|
||||||
importId = newImportId
|
importId = newImportId
|
||||||
timeZone = if (mEvent.timeZone.isEmpty()) TimeZone.getDefault().id else timeZone
|
timeZone = when {
|
||||||
|
mIsAllDayEvent -> DateTimeZone.UTC.id
|
||||||
|
timeZone.isEmpty() -> DateTimeZone.getDefault().id
|
||||||
|
else -> timeZone
|
||||||
|
}
|
||||||
flags = mEvent.flags.addBitIf(event_all_day.isChecked, FLAG_ALL_DAY)
|
flags = mEvent.flags.addBitIf(event_all_day.isChecked, FLAG_ALL_DAY)
|
||||||
repeatLimit = if (repeatInterval == 0) 0 else mRepeatLimit
|
repeatLimit = if (repeatInterval == 0) 0 else mRepeatLimit
|
||||||
repeatRule = mRepeatRule
|
repeatRule = mRepeatRule
|
||||||
|
@@ -228,8 +228,8 @@ class CalDAVHelper(val context: Context) {
|
|||||||
val event = Event(
|
val event = Event(
|
||||||
null, startTS, endTS, title, location, description, reminder1?.minutes ?: REMINDER_OFF,
|
null, startTS, endTS, title, location, description, reminder1?.minutes ?: REMINDER_OFF,
|
||||||
reminder2?.minutes ?: REMINDER_OFF, reminder3?.minutes ?: REMINDER_OFF, reminder1?.type
|
reminder2?.minutes ?: REMINDER_OFF, reminder3?.minutes ?: REMINDER_OFF, reminder1?.type
|
||||||
?: REMINDER_NOTIFICATION, reminder2?.type ?: REMINDER_NOTIFICATION, reminder3?.type
|
?: REMINDER_NOTIFICATION, reminder2?.type ?: REMINDER_NOTIFICATION, reminder3?.type
|
||||||
?: REMINDER_NOTIFICATION, repeatRule.repeatInterval, repeatRule.repeatRule,
|
?: REMINDER_NOTIFICATION, repeatRule.repeatInterval, repeatRule.repeatRule,
|
||||||
repeatRule.repeatLimit, ArrayList(), attendees, importId, eventTimeZone, allDay, eventTypeId, source = source, availability = availability
|
repeatRule.repeatLimit, ArrayList(), attendees, importId, eventTimeZone, allDay, eventTypeId, source = source, availability = availability
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -212,6 +212,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||||||
|
|
||||||
val eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
val eventType = eventTypes.firstOrNull { it.id == curEventTypeId }
|
||||||
val source = if (calDAVCalendarId == 0 || eventType?.isSyncedEventType() == false) SOURCE_IMPORTED_ICS else "$CALDAV-$calDAVCalendarId"
|
val source = if (calDAVCalendarId == 0 || eventType?.isSyncedEventType() == false) SOURCE_IMPORTED_ICS else "$CALDAV-$calDAVCalendarId"
|
||||||
|
val isAllDay = curFlags and FLAG_ALL_DAY != 0
|
||||||
val event = Event(
|
val event = Event(
|
||||||
null,
|
null,
|
||||||
curStart,
|
curStart,
|
||||||
@@ -231,7 +232,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||||||
curRepeatExceptions,
|
curRepeatExceptions,
|
||||||
"",
|
"",
|
||||||
curImportId,
|
curImportId,
|
||||||
DateTimeZone.getDefault().id,
|
if (isAllDay) DateTimeZone.UTC.id else DateTimeZone.getDefault().id,
|
||||||
curFlags,
|
curFlags,
|
||||||
curEventTypeId,
|
curEventTypeId,
|
||||||
0,
|
0,
|
||||||
@@ -240,7 +241,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
|||||||
curAvailability
|
curAvailability
|
||||||
)
|
)
|
||||||
|
|
||||||
if (event.getIsAllDay() && curEnd > curStart) {
|
if (isAllDay && curEnd > curStart) {
|
||||||
event.endTS -= DAY
|
event.endTS -= DAY
|
||||||
|
|
||||||
// fix some glitches related to daylight saving shifts
|
// fix some glitches related to daylight saving shifts
|
||||||
|
@@ -102,7 +102,7 @@ class Parser {
|
|||||||
parseLongFormat(edited, value.endsWith("Z"))
|
parseLongFormat(edited, value.endsWith("Z"))
|
||||||
} else {
|
} else {
|
||||||
val dateTimeFormat = DateTimeFormat.forPattern("yyyyMMdd")
|
val dateTimeFormat = DateTimeFormat.forPattern("yyyyMMdd")
|
||||||
dateTimeFormat.parseDateTime(edited).withHourOfDay(5).seconds()
|
dateTimeFormat.parseDateTime(edited).withHourOfDay(13).seconds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user