implement file properties dialog
This commit is contained in:
parent
f9502638f1
commit
b759f71363
|
@ -13,6 +13,7 @@ import com.bumptech.glide.signature.StringSignature
|
||||||
import com.simplemobiletools.filepicker.extensions.isAStorageRootFolder
|
import com.simplemobiletools.filepicker.extensions.isAStorageRootFolder
|
||||||
import com.simplemobiletools.filepicker.extensions.scanPaths
|
import com.simplemobiletools.filepicker.extensions.scanPaths
|
||||||
import com.simplemobiletools.filepicker.extensions.toast
|
import com.simplemobiletools.filepicker.extensions.toast
|
||||||
|
import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog
|
||||||
import com.simplemobiletools.gallery.Config
|
import com.simplemobiletools.gallery.Config
|
||||||
import com.simplemobiletools.gallery.R
|
import com.simplemobiletools.gallery.R
|
||||||
import com.simplemobiletools.gallery.activities.SimpleActivity
|
import com.simplemobiletools.gallery.activities.SimpleActivity
|
||||||
|
@ -44,6 +45,10 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
||||||
val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) {
|
val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) {
|
||||||
override fun onActionItemClicked(mode: ActionMode?, item: MenuItem): Boolean {
|
override fun onActionItemClicked(mode: ActionMode?, item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
|
R.id.cab_properties -> {
|
||||||
|
showProperties()
|
||||||
|
true
|
||||||
|
}
|
||||||
R.id.cab_edit -> {
|
R.id.cab_edit -> {
|
||||||
editDir()
|
editDir()
|
||||||
true
|
true
|
||||||
|
@ -93,6 +98,17 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showProperties() {
|
||||||
|
val selections = multiSelector.selectedPositions
|
||||||
|
if (selections.size <= 1) {
|
||||||
|
PropertiesDialog(activity, dirs[selections[0]].path, config.showHiddenFolders)
|
||||||
|
} else {
|
||||||
|
val paths = ArrayList<String>()
|
||||||
|
selections.forEach { paths.add(dirs[it].path) }
|
||||||
|
PropertiesDialog(activity, paths, config.showHiddenFolders)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun editDir() {
|
private fun editDir() {
|
||||||
val path = dirs[multiSelector.selectedPositions[0]].path
|
val path = dirs[multiSelector.selectedPositions[0]].path
|
||||||
val dir = File(path)
|
val dir = File(path)
|
||||||
|
|
Loading…
Reference in New Issue