use the helper function for checking if only one item is selected

This commit is contained in:
tibbi 2017-12-13 19:47:58 +01:00
parent d0c80a8cd0
commit ae7d3e3f18
2 changed files with 4 additions and 4 deletions

View file

@ -61,8 +61,8 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
override fun prepareActionMode(menu: Menu) {
menu.apply {
findItem(R.id.cab_rename).isVisible = selectedPositions.size == 1
findItem(R.id.cab_change_cover_image).isVisible = selectedPositions.size == 1
findItem(R.id.cab_rename).isVisible = isOneItemSelected()
findItem(R.id.cab_change_cover_image).isVisible = isOneItemSelected()
checkHideBtnVisibility(this)
checkPinBtnVisibility(this)

View file

@ -61,8 +61,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
override fun prepareActionMode(menu: Menu) {
menu.apply {
findItem(R.id.cab_rename).isVisible = selectedPositions.size == 1
findItem(R.id.cab_open_with).isVisible = selectedPositions.size == 1
findItem(R.id.cab_rename).isVisible = isOneItemSelected()
findItem(R.id.cab_open_with).isVisible = isOneItemSelected()
findItem(R.id.cab_confirm_selection).isVisible = isAGetIntent && allowMultiplePicks && selectedPositions.size > 0
checkHideBtnVisibility(this)