handle event sharing on a background thread

This commit is contained in:
tibbi 2018-11-12 20:23:01 +01:00
parent fab72371d0
commit 4f5a2de20e

View File

@ -16,10 +16,11 @@ import java.util.TreeSet
import kotlin.collections.ArrayList
fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
Thread {
val file = getTempFile()
if (file == null) {
toast(R.string.unknown_error_occurred)
return
return@Thread
}
val events = dbHelper.getEventsWithIds(ids)
@ -28,6 +29,7 @@ fun BaseSimpleActivity.shareEvents(ids: List<Long>) {
sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID)
}
}
}.start()
}
fun BaseSimpleActivity.getTempFile(): File? {