move the export path remembering in the dialog itself

This commit is contained in:
tibbi 2020-03-17 16:39:57 +01:00
parent 77bc0a92b5
commit 9c622a30bd
2 changed files with 2 additions and 2 deletions

View File

@ -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)
}

View File

@ -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)