mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2024-12-26 00:03:38 +01:00
handle event sharing on a background thread
This commit is contained in:
parent
fab72371d0
commit
4f5a2de20e
@ -16,18 +16,20 @@ import java.util.TreeSet
|
|||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
||||||
val file = getTempFile()
|
Thread {
|
||||||
if (file == null) {
|
val file = getTempFile()
|
||||||
toast(R.string.unknown_error_occurred)
|
if (file == null) {
|
||||||
return
|
toast(R.string.unknown_error_occurred)
|
||||||
}
|
return@Thread
|
||||||
|
|
||||||
val events = dbHelper.getEventsWithIds(ids)
|
|
||||||
IcsExporter().exportEvents(this, file, events, false) {
|
|
||||||
if (it == IcsExporter.ExportResult.EXPORT_OK) {
|
|
||||||
sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
val events = dbHelper.getEventsWithIds(ids)
|
||||||
|
IcsExporter().exportEvents(this, file, events, false) {
|
||||||
|
if (it == IcsExporter.ExportResult.EXPORT_OK) {
|
||||||
|
sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun BaseSimpleActivity.getTempFile(): File? {
|
fun BaseSimpleActivity.getTempFile(): File? {
|
||||||
|
Loading…
Reference in New Issue
Block a user