show the Go To Favorite button only if there are any favorites

This commit is contained in:
tibbi 2017-03-18 18:44:35 +01:00
parent 9327542b7a
commit ac4d65c69d

View file

@ -107,8 +107,11 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
menuInflater.inflate(R.menu.menu, menu)
val favorites = config.favorites
menu.findItem(R.id.add_favorite).isVisible = !favorites.contains(currentPath)
menu.findItem(R.id.remove_favorite).isVisible = favorites.contains(currentPath)
menu.apply {
findItem(R.id.add_favorite).isVisible = !favorites.contains(currentPath)
findItem(R.id.remove_favorite).isVisible = favorites.contains(currentPath)
findItem(R.id.go_to_favorite).isVisible = favorites.isNotEmpty()
}
return true
}