allow hiding the path at the exporting destination dialog

This commit is contained in:
tibbi 2020-03-16 22:49:56 +01:00
parent 39b432bf4b
commit fbfe7133ca
2 changed files with 13 additions and 7 deletions

View File

@ -520,7 +520,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
} }
private fun exportContacts() { private fun exportContacts() {
ExportContactsDialog(this, config.lastExportPath) { file, ignoredContactSources -> ExportContactsDialog(this, config.lastExportPath, false) { file, ignoredContactSources ->
config.lastExportPath = file.absolutePath.getParentPath() config.lastExportPath = file.absolutePath.getParentPath()
ContactsHelper(this).getContacts(true, ignoredContactSources) { contacts -> ContactsHelper(this).getContacts(true, ignoredContactSources) { contacts ->
if (contacts.isEmpty()) { if (contacts.isEmpty()) {

View File

@ -15,7 +15,8 @@ import kotlinx.android.synthetic.main.dialog_export_contacts.view.*
import java.io.File import java.io.File
import java.util.* import java.util.*
class ExportContactsDialog(val activity: SimpleActivity, val path: String, private val callback: (file: File, ignoredContactSources: HashSet<String>) -> Unit) { class ExportContactsDialog(val activity: SimpleActivity, val path: String, val hidePath: Boolean,
private val callback: (file: File, ignoredContactSources: HashSet<String>) -> Unit) {
private var contactSources = ArrayList<ContactSource>() private var contactSources = ArrayList<ContactSource>()
private var ignoreClicks = false private var ignoreClicks = false
private var realPath = if (path.isEmpty()) activity.internalStoragePath else path private var realPath = if (path.isEmpty()) activity.internalStoragePath else path
@ -25,11 +26,16 @@ class ExportContactsDialog(val activity: SimpleActivity, val path: String, priva
export_contacts_folder.text = activity.humanizePath(realPath) export_contacts_folder.text = activity.humanizePath(realPath)
export_contacts_filename.setText("contacts_${activity.getCurrentFormattedDateTime()}") export_contacts_filename.setText("contacts_${activity.getCurrentFormattedDateTime()}")
export_contacts_folder.setOnClickListener { if (hidePath) {
activity.hideKeyboard(export_contacts_filename) export_contacts_folder_label.beGone()
FilePickerDialog(activity, realPath, false, showFAB = true) { export_contacts_folder.beGone()
export_contacts_folder.text = activity.humanizePath(it) } else {
realPath = it export_contacts_folder.setOnClickListener {
activity.hideKeyboard(export_contacts_filename)
FilePickerDialog(activity, realPath, false, showFAB = true) {
export_contacts_folder.text = activity.humanizePath(it)
realPath = it
}
} }
} }