Merge pull request #2884 from fatihergin/feature/move-last-used-copy-destination-helpers-to-common

move last used copy path helpers to common
This commit is contained in:
Tibor Kaputa 2023-06-25 16:41:16 +02:00 committed by GitHub
commit 80fd850f70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 24 deletions

View file

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

View file

@ -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<Directory>) {
if (allDirectories.isEmpty()) {
allDirectories = newDirs.clone() as ArrayList<Directory>

View file

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