mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
do the file exporting on a background thread
This commit is contained in:
parent
98aedf7bb3
commit
d9f7707d3f
@ -126,7 +126,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
R.id.go_to_today -> goToToday()
|
||||
R.id.filter -> showFilterDialog()
|
||||
R.id.import_events -> tryImportEvents()
|
||||
// R.id.export_events -> tryExportEvents()
|
||||
R.id.export_events -> tryExportEvents()
|
||||
R.id.export_raw -> tryExportRaw()
|
||||
R.id.settings -> launchSettings()
|
||||
R.id.about -> launchAbout()
|
||||
@ -262,12 +262,16 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||
FilePickerDialog(this, pickFile = false) {
|
||||
val path = it
|
||||
ExportEventsDialog(this, path) {
|
||||
val result = IcsExporter().exportEvents(this, path)
|
||||
toast(when (result) {
|
||||
IcsExporter.ExportResult.EXPORT_OK -> R.string.events_exported_successfully
|
||||
IcsExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_events_failed
|
||||
else -> R.string.exporting_events_failed
|
||||
})
|
||||
Thread({
|
||||
val result = IcsExporter().exportEvents(this, path)
|
||||
runOnUiThread {
|
||||
toast(when (result) {
|
||||
IcsExporter.ExportResult.EXPORT_OK -> R.string.events_exported_successfully
|
||||
IcsExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_events_failed
|
||||
else -> R.string.exporting_events_failed
|
||||
})
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,10 @@
|
||||
android:id="@+id/import_events"
|
||||
android:title="@string/import_events_from_ics"
|
||||
app:showAsAction="never"/>
|
||||
<!--<item
|
||||
<item
|
||||
android:id="@+id/export_events"
|
||||
android:title="@string/export_events_to_ics"
|
||||
app:showAsAction="never"/>-->
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/export_raw"
|
||||
android:title="@string/export_raw_database"
|
||||
|
Loading…
x
Reference in New Issue
Block a user