mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
add the menu buttons for changing album cover
This commit is contained in:
parent
9676a78c1d
commit
e05ef4a9f2
2 changed files with 20 additions and 0 deletions
|
@ -111,6 +111,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
R.id.cab_move_to -> copyMoveTo(false)
|
R.id.cab_move_to -> copyMoveTo(false)
|
||||||
R.id.cab_select_all -> selectAll()
|
R.id.cab_select_all -> selectAll()
|
||||||
R.id.cab_delete -> askConfirmDelete()
|
R.id.cab_delete -> askConfirmDelete()
|
||||||
|
R.id.cab_select_photo -> changeAlbumCover(false)
|
||||||
|
R.id.cab_use_default -> changeAlbumCover(true)
|
||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -125,6 +127,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
|
|
||||||
override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean {
|
override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean {
|
||||||
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1
|
menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1
|
||||||
|
menu.findItem(R.id.cab_change_cover_image).isVisible = selectedPositions.size <= 1
|
||||||
|
|
||||||
checkHideBtnVisibility(menu)
|
checkHideBtnVisibility(menu)
|
||||||
checkPinBtnVisibility(menu)
|
checkPinBtnVisibility(menu)
|
||||||
|
@ -320,6 +323,10 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun changeAlbumCover(useDefault: Boolean) {
|
||||||
|
listener?.refreshItems()
|
||||||
|
}
|
||||||
|
|
||||||
private fun getSelectedPaths(): HashSet<String> {
|
private fun getSelectedPaths(): HashSet<String> {
|
||||||
val paths = HashSet<String>(selectedPositions.size)
|
val paths = HashSet<String>(selectedPositions.size)
|
||||||
selectedPositions.forEach { paths.add(dirs[it].path) }
|
selectedPositions.forEach { paths.add(dirs[it].path) }
|
||||||
|
|
|
@ -48,6 +48,19 @@
|
||||||
android:icon="@drawable/ic_select_all"
|
android:icon="@drawable/ic_select_all"
|
||||||
android:title="@string/select_all"
|
android:title="@string/select_all"
|
||||||
app:showAsAction="ifRoom"/>
|
app:showAsAction="ifRoom"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_change_cover_image"
|
||||||
|
android:title="@string/change_cover_image"
|
||||||
|
app:showAsAction="never">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_select_photo"
|
||||||
|
android:title="@string/select_photo"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/cab_use_default"
|
||||||
|
android:title="@string/use_default"/>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/cab_delete"
|
android:id="@+id/cab_delete"
|
||||||
android:icon="@drawable/ic_delete"
|
android:icon="@drawable/ic_delete"
|
||||||
|
|
Loading…
Reference in a new issue