hide the filter event types button if there is only 1 type
This commit is contained in:
parent
57d2ef24ac
commit
f84ff6c45c
|
@ -53,7 +53,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
var mWeekScrollY = 0
|
var mWeekScrollY = 0
|
||||||
var eventTypeColors = SparseIntArray(3)
|
var eventTypeColors = SparseIntArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -72,6 +72,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
DBHelper.newInstance(applicationContext).getEventTypes {
|
DBHelper.newInstance(applicationContext).getEventTypes {
|
||||||
eventTypeColors.clear()
|
eventTypeColors.clear()
|
||||||
it.map { eventTypeColors.put(it.id, it.color) }
|
it.map { eventTypeColors.put(it.id, it.color) }
|
||||||
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
mStoredTextColor = config.textColor
|
mStoredTextColor = config.textColor
|
||||||
mStoredPrimaryColor = config.primaryColor
|
mStoredPrimaryColor = config.primaryColor
|
||||||
|
@ -99,6 +100,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu, menu)
|
menuInflater.inflate(R.menu.menu, menu)
|
||||||
|
menu.findItem(R.id.filter).isVisible = eventTypeColors.size() > 1
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue