mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 04:28:00 +01:00
move last used copy path helpers to common
This commit is contained in:
parent
4cc164668c
commit
688cdece7d
3 changed files with 3 additions and 24 deletions
|
@ -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'
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue