do not show Favorites and Recycle bin at the copy destination picker

This commit is contained in:
tibbi 2020-01-02 23:20:53 +01:00
parent b1b9d11148
commit 9d5565be96
4 changed files with 7 additions and 5 deletions

View File

@ -150,7 +150,7 @@ class WidgetConfigureActivity : SimpleActivity() {
}
private fun changeSelectedFolder() {
PickDirectoryDialog(this, "", false) {
PickDirectoryDialog(this, "", false, true) {
updateFolderImage(it)
}
}

View File

@ -14,7 +14,8 @@ import com.simplemobiletools.gallery.pro.helpers.VIEW_TYPE_GRID
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 callback: (path: String) -> Unit) {
class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: String, showOtherFolderButton: Boolean, val showFavoritesBin: Boolean,
val callback: (path: String) -> Unit) {
private var dialog: AlertDialog
private var shownDirectories = ArrayList<Directory>()
private var allDirectories = ArrayList<Directory>()
@ -88,7 +89,8 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
if (allDirectories.isEmpty()) {
allDirectories = newDirs.clone() as ArrayList<Directory>
}
val distinctDirs = newDirs.distinctBy { it.path.getDistinctPath() }.toMutableList() as ArrayList<Directory>
val distinctDirs = newDirs.filter { showFavoritesBin || (!it.isRecycleBin() && !it.areFavorites()) }.distinctBy { it.path.getDistinctPath() }.toMutableList() as ArrayList<Directory>
val sortedDirs = activity.getSortedDirectories(distinctDirs)
val dirs = activity.getDirsToShow(sortedDirs, allDirectories, currentPathPrefix).clone() as ArrayList<Directory>
if (dirs.hashCode() == shownDirectories.hashCode()) {

View File

@ -54,7 +54,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
}
private fun showOtherFolder() {
PickDirectoryDialog(activity, path, true) {
PickDirectoryDialog(activity, path, true, true) {
callback(it)
dialog.dismiss()
}

View File

@ -208,7 +208,7 @@ fun BaseSimpleActivity.tryCopyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>,
}
val source = fileDirItems[0].getParentPath()
PickDirectoryDialog(this, source, true) {
PickDirectoryDialog(this, source, true, false) {
val destination = it
handleSAFDialog(source) {
if (it) {