fix #911, fixing a glitch at trying to parse daylight at importing

This commit is contained in:
tibbi
2019-08-28 11:37:26 +02:00
parent 85b6e218eb
commit 09eab91bf9

View File

@@ -39,6 +39,7 @@ class IcsImporter(val activity: SimpleActivity) {
private var isProperReminderAction = false private var isProperReminderAction = false
private var isDescription = false private var isDescription = false
private var isSequence = false private var isSequence = false
private var isParsingEvent = false
private var curReminderTriggerMinutes = REMINDER_OFF private var curReminderTriggerMinutes = REMINDER_OFF
private var curReminderTriggerAction = REMINDER_NOTIFICATION private var curReminderTriggerAction = REMINDER_NOTIFICATION
private val eventsHelper = activity.eventsHelper private val eventsHelper = activity.eventsHelper
@@ -83,8 +84,11 @@ class IcsImporter(val activity: SimpleActivity) {
if (line == BEGIN_EVENT) { if (line == BEGIN_EVENT) {
resetValues() resetValues()
curEventTypeId = defaultEventTypeId curEventTypeId = defaultEventTypeId
isParsingEvent = true
} else if (line.startsWith(DTSTART)) { } else if (line.startsWith(DTSTART)) {
curStart = getTimestamp(line.substring(DTSTART.length)) if (isParsingEvent) {
curStart = getTimestamp(line.substring(DTSTART.length))
}
} else if (line.startsWith(DTEND)) { } else if (line.startsWith(DTEND)) {
curEnd = getTimestamp(line.substring(DTEND.length)) curEnd = getTimestamp(line.substring(DTEND.length))
} else if (line.startsWith(DURATION)) { } else if (line.startsWith(DURATION)) {
@@ -142,6 +146,7 @@ class IcsImporter(val activity: SimpleActivity) {
curReminderActions.add(curReminderTriggerAction) curReminderActions.add(curReminderTriggerAction)
} }
} else if (line == END_EVENT) { } else if (line == END_EVENT) {
isParsingEvent = false
if (curStart != -1L && curEnd == -1L) { if (curStart != -1L && curEnd == -1L) {
curEnd = curStart curEnd = curStart
} }
@@ -304,6 +309,7 @@ class IcsImporter(val activity: SimpleActivity) {
isNotificationDescription = false isNotificationDescription = false
isProperReminderAction = false isProperReminderAction = false
isSequence = false isSequence = false
isParsingEvent = false
curReminderTriggerMinutes = REMINDER_OFF curReminderTriggerMinutes = REMINDER_OFF
curReminderTriggerAction = REMINDER_NOTIFICATION curReminderTriggerAction = REMINDER_NOTIFICATION
} }