From 688cdece7d843e6a22375e3746316cdda41d3c10 Mon Sep 17 00:00:00 2001 From: fatih ergin Date: Sun, 25 Jun 2023 12:53:41 +0300 Subject: [PATCH] move last used copy path helpers to common --- app/build.gradle | 2 +- .../pro/dialogs/PickDirectoryDialog.kt | 19 +------------------ .../gallery/pro/helpers/Config.kt | 6 +----- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 12493b9ba..7e824f210 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,7 +78,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:d6cddfa7d8' + implementation 'com.github.SimpleMobileTools:Simple-Commons:30e6321592' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.25' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt index 767457e75..f6d7cc5e7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt @@ -20,7 +20,6 @@ import com.simplemobiletools.gallery.pro.adapters.DirectoryAdapter import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.models.Directory import kotlinx.android.synthetic.main.dialog_directory_picker.view.* -import java.io.File class PickDirectoryDialog( val activity: BaseSimpleActivity, @@ -172,7 +171,7 @@ class PickDirectoryDialog( activity.hideKeyboard(searchEditText) FilePickerDialog( activity, - getDefaultCopyDestinationPath(sourcePath), + activity.getDefaultCopyDestinationPath(showHidden, sourcePath), !isPickingCopyMoveDestination && !isPickingFolderForWidget, showHidden, true, @@ -187,22 +186,6 @@ class PickDirectoryDialog( } } - private fun getDefaultCopyDestinationPath(currentPath: String): String { - val lastCopyPath = config.lastCopyPath - - return if (activity.getDoesFilePathExist(lastCopyPath)) { - val isLastCopyPathVisible = !lastCopyPath.split(File.separator).any { it.startsWith(".") && it.length > 1 } - - if (showHidden || isLastCopyPathVisible) { - lastCopyPath - } else { - currentPath - } - } else { - currentPath - } - } - private fun gotDirectories(newDirs: ArrayList) { if (allDirectories.isEmpty()) { allDirectories = newDirs.clone() as ArrayList diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 7cd88caac..b50e69740 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -8,7 +8,7 @@ import com.google.gson.reflect.TypeToken import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.models.AlbumCover -import java.util.* +import java.util.Arrays class Config(context: Context) : BaseConfig(context) { companion object { @@ -363,10 +363,6 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getString(LAST_FILEPICKER_PATH, "")!! set(lastFilepickerPath) = prefs.edit().putString(LAST_FILEPICKER_PATH, lastFilepickerPath).apply() - var lastCopyPath: String - get() = prefs.getString(LAST_COPY_PATH, "")!! - set(lastCopyPath) = prefs.edit().putString(LAST_COPY_PATH, lastCopyPath).apply() - var tempSkipDeleteConfirmation: Boolean get() = prefs.getBoolean(TEMP_SKIP_DELETE_CONFIRMATION, false) set(tempSkipDeleteConfirmation) = prefs.edit().putBoolean(TEMP_SKIP_DELETE_CONFIRMATION, tempSkipDeleteConfirmation).apply()