From 9c622a30bdc9a4d14181024f7f04da6c7a4960f3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 17 Mar 2020 16:39:57 +0100 Subject: [PATCH] move the export path remembering in the dialog itself --- .../simplemobiletools/contacts/pro/activities/MainActivity.kt | 2 -- .../contacts/pro/dialogs/ExportContactsDialog.kt | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt index 217cd579..7e0da965 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt @@ -519,7 +519,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { private fun tryExportContacts() { if (isQPlus()) { ExportContactsDialog(this, config.lastExportPath, true) { file, ignoredContactSources -> - config.lastExportPath = file.absolutePath.getParentPath() ignoredExportContactSources = ignoredContactSources Intent(Intent.ACTION_CREATE_DOCUMENT).apply { @@ -534,7 +533,6 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { handlePermission(PERMISSION_WRITE_STORAGE) { if (it) { ExportContactsDialog(this, config.lastExportPath, false) { file, ignoredContactSources -> - config.lastExportPath = file.absolutePath.getParentPath() getFileOutputStream(file.toFileDirItem(this), true) { exportContactsTo(ignoredContactSources, it) } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt index dd3678de..0d6b93bf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt @@ -8,6 +8,7 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.activities.SimpleActivity import com.simplemobiletools.contacts.pro.adapters.FilterContactSourcesAdapter +import com.simplemobiletools.contacts.pro.extensions.config import com.simplemobiletools.contacts.pro.extensions.getVisibleContactSources import com.simplemobiletools.contacts.pro.helpers.ContactsHelper import com.simplemobiletools.contacts.pro.models.ContactSource @@ -69,6 +70,7 @@ class ExportContactsDialog(val activity: SimpleActivity, val path: String, val h ignoreClicks = true ensureBackgroundThread { + activity.config.lastExportPath = file.absolutePath.getParentPath() val selectedSources = (view.export_contacts_list.adapter as FilterContactSourcesAdapter).getSelectedContactSources() val ignoredSources = contactSources.filter { !selectedSources.contains(it) }.map { it.getFullIdentifier() }.toHashSet() callback(file, ignoredSources)