mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-13 01:03:56 +01:00
handle event sharing on a background thread
This commit is contained in:
parent
fab72371d0
commit
4f5a2de20e
@ -16,10 +16,11 @@ import java.util.TreeSet
|
|||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
||||||
|
Thread {
|
||||||
val file = getTempFile()
|
val file = getTempFile()
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(R.string.unknown_error_occurred)
|
||||||
return
|
return@Thread
|
||||||
}
|
}
|
||||||
|
|
||||||
val events = dbHelper.getEventsWithIds(ids)
|
val events = dbHelper.getEventsWithIds(ids)
|
||||||
@ -28,6 +29,7 @@ fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
|
|||||||
sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
|
sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun BaseSimpleActivity.getTempFile(): File? {
|
fun BaseSimpleActivity.getTempFile(): File? {
|
||||||
|
Loading…
Reference in New Issue
Block a user