shorten some code in NotificationsFragment

This commit is contained in:
Conny Duck 2024-04-18 20:54:43 +02:00
parent c8bf78021f
commit ed37bb27a2
No known key found for this signature in database
1 changed files with 14 additions and 16 deletions

View File

@ -533,23 +533,21 @@ class NotificationsFragment :
menuInflater.inflate(R.menu.fragment_notifications, menu) menuInflater.inflate(R.menu.fragment_notifications, menu)
} }
override fun onMenuItemSelected(menuItem: MenuItem): Boolean { override fun onMenuItemSelected(menuItem: MenuItem) = when (menuItem.itemId) {
when (menuItem.itemId) { R.id.action_refresh -> {
R.id.action_refresh -> { binding.swipeRefreshLayout.isRefreshing = true
binding.swipeRefreshLayout.isRefreshing = true onRefresh()
onRefresh() true
return true
}
R.id.action_edit_notification_filter -> {
showFilterMenu()
return true
}
R.id.action_clear_notifications -> {
confirmClearNotifications()
return true
}
else -> return false
} }
R.id.action_edit_notification_filter -> {
showFilterMenu()
true
}
R.id.action_clear_notifications -> {
confirmClearNotifications()
true
}
else -> false
} }
companion object { companion object {