mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
do not always check write permissions at FilePickerDialog
This commit is contained in:
parent
0a55dbbdf3
commit
c82a683302
4 changed files with 12 additions and 7 deletions
|
@ -152,7 +152,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeSelectedFolder() {
|
private fun changeSelectedFolder() {
|
||||||
PickDirectoryDialog(this, "", false, true) {
|
PickDirectoryDialog(this, "", false, true, false, true) {
|
||||||
updateFolderImage(it)
|
updateFolderImage(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,12 @@ import com.simplemobiletools.gallery.pro.models.Directory
|
||||||
import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
|
import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
|
||||||
|
|
||||||
class PickDirectoryDialog(
|
class PickDirectoryDialog(
|
||||||
val activity: BaseSimpleActivity, val sourcePath: String, showOtherFolderButton: Boolean, val showFavoritesBin: Boolean,
|
val activity: BaseSimpleActivity,
|
||||||
|
val sourcePath: String,
|
||||||
|
showOtherFolderButton: Boolean,
|
||||||
|
val showFavoritesBin: Boolean,
|
||||||
|
val isPickingCopyMoveDestination: Boolean,
|
||||||
|
val isPickingFolderForWidget: Boolean,
|
||||||
val callback: (path: String) -> Unit
|
val callback: (path: String) -> Unit
|
||||||
) {
|
) {
|
||||||
private var dialog: AlertDialog
|
private var dialog: AlertDialog
|
||||||
|
@ -81,7 +86,7 @@ class PickDirectoryDialog(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showOtherFolder() {
|
private fun showOtherFolder() {
|
||||||
FilePickerDialog(activity, sourcePath, false, showHidden, true, true) {
|
FilePickerDialog(activity, sourcePath, !isPickingCopyMoveDestination && !isPickingFolderForWidget, showHidden, true, true) {
|
||||||
activity.handleLockedFolderOpening(it) { success ->
|
activity.handleLockedFolderOpening(it) { success ->
|
||||||
if (success) {
|
if (success) {
|
||||||
callback(it)
|
callback(it)
|
||||||
|
@ -108,10 +113,10 @@ class PickDirectoryDialog(
|
||||||
val clickedDir = it as Directory
|
val clickedDir = it as Directory
|
||||||
val path = clickedDir.path
|
val path = clickedDir.path
|
||||||
if (clickedDir.subfoldersCount == 1 || !activity.config.groupDirectSubfolders) {
|
if (clickedDir.subfoldersCount == 1 || !activity.config.groupDirectSubfolders) {
|
||||||
if (path.trimEnd('/') == sourcePath) {
|
if (isPickingCopyMoveDestination && path.trimEnd('/') == sourcePath) {
|
||||||
activity.toast(R.string.source_and_destination_same)
|
activity.toast(R.string.source_and_destination_same)
|
||||||
return@DirectoryAdapter
|
return@DirectoryAdapter
|
||||||
} else if (activity.isRestrictedWithSAFSdk30(path) && !activity.isInDownloadDir(path)) {
|
} else if (isPickingCopyMoveDestination && activity.isRestrictedWithSAFSdk30(path) && !activity.isInDownloadDir(path)) {
|
||||||
activity.toast(R.string.system_folder_restriction, Toast.LENGTH_LONG)
|
activity.toast(R.string.system_folder_restriction, Toast.LENGTH_LONG)
|
||||||
return@DirectoryAdapter
|
return@DirectoryAdapter
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,7 +58,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showOtherFolder() {
|
private fun showOtherFolder() {
|
||||||
PickDirectoryDialog(activity, path, true, true) {
|
PickDirectoryDialog(activity, path, true, true, false, false) {
|
||||||
callback(it)
|
callback(it)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ fun BaseSimpleActivity.tryCopyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>,
|
||||||
}
|
}
|
||||||
|
|
||||||
val source = fileDirItems[0].getParentPath()
|
val source = fileDirItems[0].getParentPath()
|
||||||
PickDirectoryDialog(this, source, true, false) {
|
PickDirectoryDialog(this, source, true, false, true, false) {
|
||||||
val destination = it
|
val destination = it
|
||||||
handleSAFDialog(source) {
|
handleSAFDialog(source) {
|
||||||
if (it) {
|
if (it) {
|
||||||
|
|
Loading…
Reference in a new issue