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