allow hiding the path at ExportEventsDialog

This commit is contained in:
tibbi 2020-03-17 12:21:13 +01:00
parent 655d3eedcc
commit 233fff3850
2 changed files with 8 additions and 2 deletions

View File

@ -790,7 +790,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun exportEvents() {
FilePickerDialog(this, pickFile = false, showFAB = true) {
ExportEventsDialog(this, it) { exportPastEvents, file, eventTypes ->
ExportEventsDialog(this, it, false) { exportPastEvents, file, eventTypes ->
ensureBackgroundThread {
val events = eventsHelper.getEventsToExport(exportPastEvents, eventTypes)
if (events.isEmpty()) {

View File

@ -12,13 +12,19 @@ import kotlinx.android.synthetic.main.dialog_export_events.view.*
import java.io.File
import java.util.*
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val callback: (exportPastEvents: Boolean, file: File, eventTypes: ArrayList<Long>) -> Unit) {
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val hidePath: Boolean,
val callback: (exportPastEvents: Boolean, file: File, eventTypes: ArrayList<Long>) -> Unit) {
init {
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
export_events_folder.text = activity.humanizePath(path)
export_events_filename.setText("${activity.getString(R.string.events)}_${activity.getCurrentFormattedDateTime()}")
if (hidePath) {
export_events_folder_label.beGone()
export_events_folder.beGone()
}
activity.eventsHelper.getEventTypes(activity, false) {
val eventTypes = HashSet<String>()
it.mapTo(eventTypes) { it.id.toString() }