Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bitfireAT/ical4android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Lang <72232737+patrickunterwegs@users.noreply.github.com>2022-01-24 00:24:12 +0300
committerGitHub <noreply@github.com>2022-01-24 00:24:12 +0300
commit04dcf5ca80a1c6f5efc24bda63633ea4d150ddd0 (patch)
tree7e8ebd3d406b39574d72f6e2f54039d40894a4f9
parentd7ef7a2acf2de831b819f409379df0f12efd572a (diff)
Refactored ics-generation, using ical4android now
-rw-r--r--src/main/java/at/bitfire/ical4android/JtxICalObject.kt20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/at/bitfire/ical4android/JtxICalObject.kt b/src/main/java/at/bitfire/ical4android/JtxICalObject.kt
index a71fbdb..7a9218c 100644
--- a/src/main/java/at/bitfire/ical4android/JtxICalObject.kt
+++ b/src/main/java/at/bitfire/ical4android/JtxICalObject.kt
@@ -535,11 +535,11 @@ open class JtxICalObject(
}
/**
- * Takes the current JtxICalObject, transforms it to an iCalendar and writes it in an OutputStream
- * @param [os] OutputStream where iCalendar should be written to
+ * Takes the current JtxICalObject and transforms it to a Calendar (ical4j)
+ * @return The current JtxICalObject transformed into a ical4j Calendar
*/
@UsesThreadContextClassLoader
- fun write(os: OutputStream) {
+ fun getICalendarFormat(): Calendar? {
Ical4Android.checkThreadContextClassLoader()
val ical = Calendar()
@@ -549,7 +549,7 @@ open class JtxICalObject(
val calComponent = when (component) {
JtxContract.JtxICalObject.Component.VTODO.name -> VToDo(true /* generates DTSTAMP */)
JtxContract.JtxICalObject.Component.VJOURNAL.name -> VJournal(true /* generates DTSTAMP */)
- else -> return
+ else -> return null
}
ical.components += calComponent
addProperties(calComponent.properties)
@@ -625,7 +625,17 @@ open class JtxICalObject(
}
ICalendar.softValidate(ical)
- CalendarOutputter(false).output(ical, os)
+ return ical
+ }
+
+ /**
+ * Takes the current JtxICalObject, transforms it to an iCalendar and writes it in an OutputStream
+ * @param [os] OutputStream where iCalendar should be written to
+ */
+ @UsesThreadContextClassLoader
+ fun write(os: OutputStream) {
+ Ical4Android.checkThreadContextClassLoader()
+ CalendarOutputter(false).output(this.getICalendarFormat(), os)
}
/**