diff --git a/app/build.gradle b/app/build.gradle index 1a1ce861..0584b78c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,7 +45,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.11.5' + implementation 'com.simplemobiletools:commons:3.12.15' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 99f7f95d..c3692df2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -172,6 +172,11 @@ android:label="@string/customize_colors" android:parentActivityName=".activities.SettingsActivity"/> + + ) { VcfExporter().exportContacts(this, file, contacts) { if (it == VcfExporter.ExportResult.EXPORT_OK) { - val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) - shareUri(uri, BuildConfig.APPLICATION_ID) + sharePathIntent(file.absolutePath, BuildConfig.APPLICATION_ID) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/Config.kt index d34fbc68..f6613b07 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/Config.kt @@ -2,18 +2,12 @@ package com.simplemobiletools.contacts.helpers import android.content.Context import com.simplemobiletools.commons.helpers.BaseConfig -import com.simplemobiletools.commons.helpers.SORTING -import com.simplemobiletools.commons.helpers.SORT_BY_FIRST_NAME class Config(context: Context) : BaseConfig(context) { companion object { fun newInstance(context: Context) = Config(context) } - var sorting: Int - get() = prefs.getInt(SORTING, SORT_BY_FIRST_NAME) - set(sorting) = prefs.edit().putInt(SORTING, sorting).apply() - var displayContactSources: Set get() = prefs.getStringSet(DISPLAY_CONTACT_SOURCES, hashSetOf("-1")) set(displayContactSources) = prefs.edit().remove(DISPLAY_CONTACT_SOURCES).putStringSet(DISPLAY_CONTACT_SOURCES, displayContactSources).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt index a7c4994b..793a8ccc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/helpers/VcfExporter.kt @@ -8,6 +8,7 @@ import android.util.Base64 import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.getFileOutputStream import com.simplemobiletools.commons.extensions.showErrorToast +import com.simplemobiletools.commons.extensions.toFileDirItem import com.simplemobiletools.commons.extensions.writeLn import com.simplemobiletools.contacts.helpers.VcfExporter.ExportResult.* import com.simplemobiletools.contacts.models.Contact @@ -27,7 +28,7 @@ class VcfExporter { fun exportContacts(activity: BaseSimpleActivity, file: File, contacts: ArrayList, callback: (result: ExportResult) -> Unit) { try { - activity.getFileOutputStream(file) { + activity.getFileOutputStream(file.toFileDirItem(activity)) { if (it == null) { callback(EXPORT_FAIL) return@getFileOutputStream diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml new file mode 100644 index 00000000..11ccda4a --- /dev/null +++ b/app/src/main/res/values/integers.xml @@ -0,0 +1,3 @@ + + 128 +