hide the GoToToday button at event list view

This commit is contained in:
tibbi 2017-02-19 20:36:21 +01:00
parent 644a9fbd03
commit 2022081881
1 changed files with 7 additions and 0 deletions

View File

@ -100,6 +100,8 @@ class MainActivity : SimpleActivity(), NavigationListener {
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_main, menu)
menu.findItem(R.id.filter).isVisible = eventTypeColors.size() > 1 || config.displayEventTypes.isEmpty()
menu.findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible()
return true
}
@ -127,6 +129,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
private fun showViewDialog() {
ChangeViewDialog(this) {
updateView(it)
invalidateOptionsMenu()
}
}
@ -134,6 +137,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
}
private fun shouldGoToTodayBeVisible(): Boolean {
return config.storedView == WEEKLY_VIEW || config.storedView == MONTHLY_VIEW || config.storedView == YEARLY_VIEW
}
private fun showFilterDialog() {
FilterEventTypesDialog(this) {
refreshViewPager()