show the rotate actionbar button only if the current item is an image
This commit is contained in:
parent
964ffe360a
commit
90a87615d9
1 changed files with 10 additions and 9 deletions
|
@ -95,11 +95,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_viewpager, menu)
|
||||
if (getCurrentMedium() == null)
|
||||
return true
|
||||
|
||||
menu.apply {
|
||||
if (getCurrentMedium()?.isImage() == true) {
|
||||
findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()?.isImage() == true
|
||||
findItem(R.id.menu_edit).isVisible = getCurrentMedium()?.isImage() == true
|
||||
findItem(R.id.menu_set_as_wallpaper).isVisible = getCurrentMedium()!!.isImage() == true
|
||||
findItem(R.id.menu_edit).isVisible = getCurrentMedium()!!.isImage() == true
|
||||
findItem(R.id.menu_rotate).isVisible = getCurrentMedium()!!.isImage() == true
|
||||
|
||||
findItem(R.id.menu_rotate).subMenu.apply {
|
||||
clearHeader()
|
||||
|
@ -108,7 +110,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
findItem(R.id.rotate_one_eighty).icon = resources.getColoredDrawable(R.drawable.ic_rotate_one_eighty, R.color.actionbar_menu_icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue