do not pass exportPastEvents in the Export dialogs callback

This commit is contained in:
tibbi 2020-03-17 16:51:03 +01:00
parent a7d8c88174
commit dabbe0dff1
2 changed files with 17 additions and 21 deletions

View File

@ -783,15 +783,9 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun tryExportEvents() {
handlePermission(PERMISSION_WRITE_STORAGE) {
if (it) {
exportEvents()
}
}
}
private fun exportEvents() {
ExportEventsDialog(this, config.lastExportPath, false) { exportPastEvents, file, eventTypes ->
ExportEventsDialog(this, config.lastExportPath, false) { file, eventTypes ->
ensureBackgroundThread {
val events = eventsHelper.getEventsToExport(exportPastEvents, eventTypes)
val events = eventsHelper.getEventsToExport(config.exportPastEvents, eventTypes)
if (events.isEmpty()) {
toast(R.string.no_entries_for_exporting)
} else {
@ -808,6 +802,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
}
}
}
}
}
private fun launchSettings() {
startActivity(Intent(applicationContext, SettingsActivity::class.java))

View File

@ -15,7 +15,7 @@ import java.io.File
import java.util.*
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
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
val eventTypes = (view.export_events_types_list.adapter as FilterEventTypeAdapter).getSelectedItemsList()
callback(view.export_events_checkbox.isChecked, file, eventTypes)
callback(file, eventTypes)
dismiss()
}
else -> activity.toast(R.string.invalid_name)