mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
fix #461, properly handle the Location field at importing
This commit is contained in:
@@ -182,8 +182,6 @@ class CalDAVHandler(val context: Context) {
|
||||
colors.put(colorKey, color)
|
||||
} while (cursor.moveToNext())
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("DEBUG", "exc $e")
|
||||
} finally {
|
||||
cursor?.close()
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ const val STATUS = "STATUS:"
|
||||
const val EXDATE = "EXDATE"
|
||||
const val BYDAY = "BYDAY"
|
||||
const val BYMONTHDAY = "BYMONTHDAY"
|
||||
const val LOCATION = "LOCATION:"
|
||||
const val LOCATION = "LOCATION"
|
||||
|
||||
// this tag isn't a standard ICS tag, but there's no official way of adding a category color in an ics file
|
||||
const val CATEGORY_COLOR = "CATEGORY_COLOR:"
|
||||
|
@@ -119,7 +119,7 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||
|
||||
curRepeatExceptions.add(getTimestamp(value))
|
||||
} else if (line.startsWith(LOCATION)) {
|
||||
curLocation = line.substring(LOCATION.length).replace("\\,", ",")
|
||||
curLocation = getLocation(line.substring(LOCATION.length).replace("\\,", ","))
|
||||
} else if (line == END_ALARM) {
|
||||
if (isProperReminderAction && curReminderTriggerMinutes != -1) {
|
||||
curReminderMinutes.add(curReminderTriggerMinutes)
|
||||
@@ -203,6 +203,14 @@ class IcsImporter(val activity: SimpleActivity) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLocation(fullString: String): String {
|
||||
return if (fullString.startsWith(":")) {
|
||||
fullString.trimStart(':')
|
||||
} else {
|
||||
fullString.substringAfter(':').trim()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryAddCategories(categories: String, context: Context) {
|
||||
val eventTypeTitle = if (categories.contains(",")) {
|
||||
categories.split(",")[0]
|
||||
|
Reference in New Issue
Block a user