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() {
|
||||
PickDirectoryDialog(this, "", false, true) {
|
||||
PickDirectoryDialog(this, "", false, true, false, true) {
|
||||
updateFolderImage(it)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,12 @@ import com.simplemobiletools.gallery.pro.models.Directory
|
|||
import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
|
||||
|
||||
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
|
||||
) {
|
||||
private var dialog: AlertDialog
|
||||
|
@ -81,7 +86,7 @@ class PickDirectoryDialog(
|
|||
}
|
||||
|
||||
private fun showOtherFolder() {
|
||||
FilePickerDialog(activity, sourcePath, false, showHidden, true, true) {
|
||||
FilePickerDialog(activity, sourcePath, !isPickingCopyMoveDestination && !isPickingFolderForWidget, showHidden, true, true) {
|
||||
activity.handleLockedFolderOpening(it) { success ->
|
||||
if (success) {
|
||||
callback(it)
|
||||
|
@ -108,10 +113,10 @@ class PickDirectoryDialog(
|
|||
val clickedDir = it as Directory
|
||||
val path = clickedDir.path
|
||||
if (clickedDir.subfoldersCount == 1 || !activity.config.groupDirectSubfolders) {
|
||||
if (path.trimEnd('/') == sourcePath) {
|
||||
if (isPickingCopyMoveDestination && path.trimEnd('/') == sourcePath) {
|
||||
activity.toast(R.string.source_and_destination_same)
|
||||
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)
|
||||
return@DirectoryAdapter
|
||||
} else {
|
||||
|
|
|
@ -58,7 +58,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
|||
}
|
||||
|
||||
private fun showOtherFolder() {
|
||||
PickDirectoryDialog(activity, path, true, true) {
|
||||
PickDirectoryDialog(activity, path, true, true, false, false) {
|
||||
callback(it)
|
||||
dialog.dismiss()
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ fun BaseSimpleActivity.tryCopyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>,
|
|||
}
|
||||
|
||||
val source = fileDirItems[0].getParentPath()
|
||||
PickDirectoryDialog(this, source, true, false) {
|
||||
PickDirectoryDialog(this, source, true, false, true, false) {
|
||||
val destination = it
|
||||
handleSAFDialog(source) {
|
||||
if (it) {
|
||||
|
|
Loading…
Reference in a new issue