mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
add a Select all button to the directories screen too
This commit is contained in:
parent
08879ee1e1
commit
674c82c15d
2 changed files with 17 additions and 0 deletions
|
@ -67,6 +67,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
R.id.cab_hide -> toggleFoldersVisibility(true)
|
||||
R.id.cab_unhide -> toggleFoldersVisibility(false)
|
||||
R.id.cab_copy_move -> displayCopyDialog()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
else -> return false
|
||||
}
|
||||
|
@ -203,6 +204,17 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
})
|
||||
}
|
||||
|
||||
fun selectAll() {
|
||||
val cnt = dirs.size
|
||||
for (i in 0..cnt - 1) {
|
||||
markedItems.add(i)
|
||||
multiSelector.setSelected(i, 0, true)
|
||||
notifyItemChanged(i)
|
||||
}
|
||||
actMode?.title = cnt.toString()
|
||||
actMode?.invalidate()
|
||||
}
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
ConfirmationDialog(activity) {
|
||||
actMode?.finish()
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
android:icon="@mipmap/copy"
|
||||
android:title="@string/copy_move"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/cab_select_all"
|
||||
android:icon="@mipmap/select_all"
|
||||
android:title="@string/select_all"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/cab_delete"
|
||||
android:icon="@mipmap/delete"
|
||||
|
|
Loading…
Reference in a new issue