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

View File

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