allow hiding the path at ExportEventsDialog
This commit is contained in:
parent
655d3eedcc
commit
233fff3850
|
@ -790,7 +790,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
|
|
||||||
private fun exportEvents() {
|
private fun exportEvents() {
|
||||||
FilePickerDialog(this, pickFile = false, showFAB = true) {
|
FilePickerDialog(this, pickFile = false, showFAB = true) {
|
||||||
ExportEventsDialog(this, it) { exportPastEvents, file, eventTypes ->
|
ExportEventsDialog(this, it, false) { exportPastEvents, file, eventTypes ->
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
val events = eventsHelper.getEventsToExport(exportPastEvents, eventTypes)
|
val events = eventsHelper.getEventsToExport(exportPastEvents, eventTypes)
|
||||||
if (events.isEmpty()) {
|
if (events.isEmpty()) {
|
||||||
|
|
|
@ -12,13 +12,19 @@ import kotlinx.android.synthetic.main.dialog_export_events.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
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 {
|
init {
|
||||||
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
|
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
|
||||||
export_events_folder.text = activity.humanizePath(path)
|
export_events_folder.text = activity.humanizePath(path)
|
||||||
export_events_filename.setText("${activity.getString(R.string.events)}_${activity.getCurrentFormattedDateTime()}")
|
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) {
|
activity.eventsHelper.getEventTypes(activity, false) {
|
||||||
val eventTypes = HashSet<String>()
|
val eventTypes = HashSet<String>()
|
||||||
it.mapTo(eventTypes) { it.id.toString() }
|
it.mapTo(eventTypes) { it.id.toString() }
|
||||||
|
|
Loading…
Reference in New Issue