add a couple more parameters to exported events

This commit is contained in:
tibbi 2017-04-03 22:35:28 +02:00
parent d5d9df7260
commit 527ca0d39f
2 changed files with 14 additions and 2 deletions

View File

@ -64,12 +64,16 @@ val ACTION = "ACTION:"
val TRIGGER = "TRIGGER:" val TRIGGER = "TRIGGER:"
val RRULE = "RRULE:" val RRULE = "RRULE:"
val CATEGORIES = "CATEGORIES:" val CATEGORIES = "CATEGORIES:"
val STATUS = "STATUS:"
val DISPLAY = "DISPLAY" val DISPLAY = "DISPLAY"
val FREQ = "FREQ" val FREQ = "FREQ"
val UNTIL = "UNTIL" val UNTIL = "UNTIL"
val COUNT = "COUNT" val COUNT = "COUNT"
val INTERVAL = "INTERVAL" val INTERVAL = "INTERVAL"
val CONFIRMED = "CONFIRMED"
val VALUE = "VALUE"
val DATE = "DATE"
val DAILY = "DAILY" val DAILY = "DAILY"
val WEEKLY = "WEEKLY" val WEEKLY = "WEEKLY"

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.calendar.helpers package com.simplemobiletools.calendar.helpers
import android.content.Context import android.content.Context
import com.simplemobiletools.calendar.extensions.dbHelper
import com.simplemobiletools.calendar.extensions.writeLn import com.simplemobiletools.calendar.extensions.writeLn
import com.simplemobiletools.calendar.helpers.IcsExporter.ExportResult.* import com.simplemobiletools.calendar.helpers.IcsExporter.ExportResult.*
import com.simplemobiletools.calendar.models.Event import com.simplemobiletools.calendar.models.Event
@ -24,8 +25,15 @@ class IcsExporter {
event.title.let { if (it.isNotEmpty()) out.writeLn("$SUMMARY$it") } event.title.let { if (it.isNotEmpty()) out.writeLn("$SUMMARY$it") }
event.description.let { if (it.isNotEmpty()) out.writeLn("$DESCRIPTION$it") } event.description.let { if (it.isNotEmpty()) out.writeLn("$DESCRIPTION$it") }
event.importId?.let { if (it.isNotEmpty()) out.writeLn("$UID$it") } event.importId?.let { if (it.isNotEmpty()) out.writeLn("$UID$it") }
event.startTS.let { out.writeLn("$DTSTART:${Formatter.getExportedTime(it)}") } event.eventType.let { out.writeLn("$CATEGORIES${context.dbHelper.getEventType(it)?.title}") }
event.endTS.let { out.writeLn("$DTEND:${Formatter.getExportedTime(it)}") }
if (event.isAllDay) {
out.writeLn("$DTSTART;$VALUE=$DATE:${Formatter.getDayCodeFromTS(event.startTS)}")
} else {
event.startTS.let { out.writeLn("$DTSTART:${Formatter.getExportedTime(it)}") }
event.endTS.let { out.writeLn("$DTEND:${Formatter.getExportedTime(it)}") }
}
out.writeLn("$STATUS$CONFIRMED")
out.writeLn(END_EVENT) out.writeLn(END_EVENT)
} }