shorten some switch cases
This commit is contained in:
parent
27ec78ad18
commit
5e08224f43
|
@ -210,17 +210,12 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.cab_delete -> {
|
R.id.cab_delete -> deleteEvent()
|
||||||
deleteEvent()
|
R.id.save -> saveEvent()
|
||||||
true
|
else -> return super.onOptionsItemSelected(item)
|
||||||
}
|
|
||||||
R.id.save -> {
|
|
||||||
saveEvent()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
else -> super.onOptionsItemSelected(item)
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteEvent() {
|
private fun deleteEvent() {
|
||||||
|
|
|
@ -58,21 +58,13 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.change_view -> {
|
R.id.change_view -> showViewDialog()
|
||||||
showViewDialog()
|
R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||||
true
|
R.id.about -> startActivity(Intent(applicationContext, AboutActivity::class.java))
|
||||||
}
|
else -> return super.onOptionsItemSelected(item)
|
||||||
R.id.settings -> {
|
|
||||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
|
||||||
true
|
|
||||||
}
|
|
||||||
R.id.about -> {
|
|
||||||
startActivity(Intent(applicationContext, AboutActivity::class.java))
|
|
||||||
true
|
|
||||||
}
|
|
||||||
else -> super.onOptionsItemSelected(item)
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
|
Loading…
Reference in New Issue