if an ics file event contains multiple categories, use the first one
This commit is contained in:
parent
6d93a7def5
commit
da75540321
|
@ -155,18 +155,21 @@ class IcsParser {
|
|||
}
|
||||
|
||||
private fun tryAddCategories(categories: String, context: Context) {
|
||||
if (!categories.contains(",")) {
|
||||
val eventTitle = categories
|
||||
val eventTypeTitle = if (categories.contains(",")) {
|
||||
categories.split(",")[0]
|
||||
} else {
|
||||
categories
|
||||
}
|
||||
|
||||
val dbHelper = DBHelper.newInstance(context)
|
||||
val eventId = dbHelper.getEventTypeIdWithTitle(eventTitle)
|
||||
val eventId = dbHelper.getEventTypeIdWithTitle(eventTypeTitle)
|
||||
if (eventId == -1) {
|
||||
val eventType = EventType(0, eventTitle, context.resources.getColor(R.color.color_primary))
|
||||
val eventType = EventType(0, eventTypeTitle, context.resources.getColor(R.color.color_primary))
|
||||
curEventType = dbHelper.insertEventType(eventType)
|
||||
} else {
|
||||
curEventType = eventId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// P0DT1H0M0S
|
||||
private fun decodeTime(duration: String): Int {
|
||||
|
|
Loading…
Reference in New Issue