mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-18 04:40:36 +01:00
do not pass exportPastEvents in the Export dialogs callback
This commit is contained in:
parent
a7d8c88174
commit
dabbe0dff1
@ -783,25 +783,21 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||||||
private fun tryExportEvents() {
|
private fun tryExportEvents() {
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
if (it) {
|
if (it) {
|
||||||
exportEvents()
|
ExportEventsDialog(this, config.lastExportPath, false) { file, eventTypes ->
|
||||||
}
|
ensureBackgroundThread {
|
||||||
}
|
val events = eventsHelper.getEventsToExport(config.exportPastEvents, eventTypes)
|
||||||
}
|
if (events.isEmpty()) {
|
||||||
|
toast(R.string.no_entries_for_exporting)
|
||||||
private fun exportEvents() {
|
} else {
|
||||||
ExportEventsDialog(this, config.lastExportPath, false) { exportPastEvents, file, eventTypes ->
|
getFileOutputStream(file.toFileDirItem(this), true) {
|
||||||
ensureBackgroundThread {
|
IcsExporter().exportEvents(this, it, events, true) {
|
||||||
val events = eventsHelper.getEventsToExport(exportPastEvents, eventTypes)
|
toast(when (it) {
|
||||||
if (events.isEmpty()) {
|
IcsExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful
|
||||||
toast(R.string.no_entries_for_exporting)
|
IcsExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
|
||||||
} else {
|
else -> R.string.exporting_failed
|
||||||
getFileOutputStream(file.toFileDirItem(this), true) {
|
})
|
||||||
IcsExporter().exportEvents(this, it, events, true) {
|
}
|
||||||
toast(when (it) {
|
}
|
||||||
IcsExporter.ExportResult.EXPORT_OK -> R.string.exporting_successful
|
|
||||||
IcsExporter.ExportResult.EXPORT_PARTIAL -> R.string.exporting_some_entries_failed
|
|
||||||
else -> R.string.exporting_failed
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import java.io.File
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val hidePath: Boolean,
|
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val hidePath: Boolean,
|
||||||
val callback: (exportPastEvents: Boolean, file: File, eventTypes: ArrayList<Long>) -> Unit) {
|
val callback: (file: File, eventTypes: ArrayList<Long>) -> Unit) {
|
||||||
private var realPath = if (path.isEmpty()) activity.internalStoragePath else path
|
private var realPath = if (path.isEmpty()) activity.internalStoragePath else path
|
||||||
val config = activity.config
|
val config = activity.config
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class ExportEventsDialog(val activity: SimpleActivity, val path: String, val hid
|
|||||||
config.exportPastEvents = view.export_events_checkbox.isChecked
|
config.exportPastEvents = view.export_events_checkbox.isChecked
|
||||||
|
|
||||||
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsList()
|
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsList()
|
||||||
callback(view.export_events_checkbox.isChecked, file, eventTypes)
|
callback(file, eventTypes)
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
else -> activity.toast(R.string.invalid_name)
|
else -> activity.toast(R.string.invalid_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user