mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
rename copy path getter method for common usage & simplify copy path checks
This commit is contained in:
parent
411c732fa8
commit
ab6eb93394
1 changed files with 17 additions and 8 deletions
|
@ -170,7 +170,14 @@ class PickDirectoryDialog(
|
||||||
|
|
||||||
private fun showOtherFolder() {
|
private fun showOtherFolder() {
|
||||||
activity.hideKeyboard(searchEditText)
|
activity.hideKeyboard(searchEditText)
|
||||||
FilePickerDialog(activity, getOtherFolderOpeningPath(), !isPickingCopyMoveDestination && !isPickingFolderForWidget, showHidden, true, true) {
|
FilePickerDialog(
|
||||||
|
activity,
|
||||||
|
getDefaultCopyDestinationPath(sourcePath),
|
||||||
|
!isPickingCopyMoveDestination && !isPickingFolderForWidget,
|
||||||
|
showHidden,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
) {
|
||||||
config.lastCopyPath = it
|
config.lastCopyPath = it
|
||||||
activity.handleLockedFolderOpening(it) { success ->
|
activity.handleLockedFolderOpening(it) { success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -180,17 +187,19 @@ class PickDirectoryDialog(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getOtherFolderOpeningPath(): String {
|
private fun getDefaultCopyDestinationPath(currentPath: String): String {
|
||||||
val lastCopyPath = config.lastCopyPath
|
val lastCopyPath = config.lastCopyPath
|
||||||
|
|
||||||
val lastCopyPathVisible = {
|
return if (activity.getDoesFilePathExist(lastCopyPath)) {
|
||||||
showHidden || !lastCopyPath.split(File.separator).any { it.startsWith(".") && it.length > 1 }
|
val isLastCopyPathVisible = !lastCopyPath.split(File.separator).any { it.startsWith(".") && it.length > 1 }
|
||||||
}
|
|
||||||
|
|
||||||
return if (activity.getDoesFilePathExist(lastCopyPath) && lastCopyPathVisible()) {
|
if (showHidden || isLastCopyPathVisible) {
|
||||||
lastCopyPath
|
lastCopyPath
|
||||||
} else {
|
} else {
|
||||||
sourcePath
|
currentPath
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
currentPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue