move the refresh_caldav_calendars menu visibility check in onPrepareOptionsMenu
This commit is contained in:
parent
8969043de2
commit
398653ee64
|
@ -123,10 +123,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
}
|
||||
|
||||
dbHelper.getEventTypes {
|
||||
eventTypeColors.clear()
|
||||
it.map { eventTypeColors.put(it.id, it.color) }
|
||||
mShouldFilterBeVisible = eventTypeColors.size() > 1 || config.displayEventTypes.isEmpty()
|
||||
invalidateOptionsMenu()
|
||||
mShouldFilterBeVisible = it.size > 1 || config.displayEventTypes.isEmpty()
|
||||
}
|
||||
|
||||
if (config.storedView == WEEKLY_VIEW) {
|
||||
|
@ -162,13 +159,20 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
|||
goToTodayButton = findItem(R.id.go_to_today)
|
||||
findItem(R.id.filter).isVisible = mShouldFilterBeVisible
|
||||
findItem(R.id.go_to_today).isVisible = shouldGoToTodayBeVisible && config.storedView != EVENTS_LIST_VIEW
|
||||
findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
|
||||
}
|
||||
|
||||
setupSearch(menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
||||
menu!!.apply {
|
||||
findItem(R.id.refresh_caldav_calendars).isVisible = config.caldavSync
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.change_view -> showViewDialog()
|
||||
|
|
Loading…
Reference in New Issue