implement file properties dialog

This commit is contained in:
tibbi 2016-11-17 12:36:27 +01:00
parent f9502638f1
commit b759f71363
1 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import com.bumptech.glide.signature.StringSignature
import com.simplemobiletools.filepicker.extensions.isAStorageRootFolder
import com.simplemobiletools.filepicker.extensions.scanPaths
import com.simplemobiletools.filepicker.extensions.toast
import com.simplemobiletools.fileproperties.dialogs.PropertiesDialog
import com.simplemobiletools.gallery.Config
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity
@ -44,6 +45,10 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) {
override fun onActionItemClicked(mode: ActionMode?, item: MenuItem): Boolean {
return when (item.itemId) {
R.id.cab_properties -> {
showProperties()
true
}
R.id.cab_edit -> {
editDir()
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() {
val path = dirs[multiSelector.selectedPositions[0]].path
val dir = File(path)