do not show Favorites and Recycle bin at the copy destination picker
This commit is contained in:
parent
b1b9d11148
commit
9d5565be96
|
@ -150,7 +150,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeSelectedFolder() {
|
private fun changeSelectedFolder() {
|
||||||
PickDirectoryDialog(this, "", false) {
|
PickDirectoryDialog(this, "", false, true) {
|
||||||
updateFolderImage(it)
|
updateFolderImage(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ import com.simplemobiletools.gallery.pro.helpers.VIEW_TYPE_GRID
|
||||||
import com.simplemobiletools.gallery.pro.models.Directory
|
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(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 dialog: AlertDialog
|
||||||
private var shownDirectories = ArrayList<Directory>()
|
private var shownDirectories = ArrayList<Directory>()
|
||||||
private var allDirectories = ArrayList<Directory>()
|
private var allDirectories = ArrayList<Directory>()
|
||||||
|
@ -88,7 +89,8 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
|
||||||
if (allDirectories.isEmpty()) {
|
if (allDirectories.isEmpty()) {
|
||||||
allDirectories = newDirs.clone() as ArrayList<Directory>
|
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 sortedDirs = activity.getSortedDirectories(distinctDirs)
|
||||||
val dirs = activity.getDirsToShow(sortedDirs, allDirectories, currentPathPrefix).clone() as ArrayList<Directory>
|
val dirs = activity.getDirsToShow(sortedDirs, allDirectories, currentPathPrefix).clone() as ArrayList<Directory>
|
||||||
if (dirs.hashCode() == shownDirectories.hashCode()) {
|
if (dirs.hashCode() == shownDirectories.hashCode()) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showOtherFolder() {
|
private fun showOtherFolder() {
|
||||||
PickDirectoryDialog(activity, path, true) {
|
PickDirectoryDialog(activity, path, true, true) {
|
||||||
callback(it)
|
callback(it)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,7 @@ fun BaseSimpleActivity.tryCopyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>,
|
||||||
}
|
}
|
||||||
|
|
||||||
val source = fileDirItems[0].getParentPath()
|
val source = fileDirItems[0].getParentPath()
|
||||||
PickDirectoryDialog(this, source, true) {
|
PickDirectoryDialog(this, source, true, false) {
|
||||||
val destination = it
|
val destination = it
|
||||||
handleSAFDialog(source) {
|
handleSAFDialog(source) {
|
||||||
if (it) {
|
if (it) {
|
||||||
|
|
Loading…
Reference in New Issue