mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-24 20:18:45 +02:00
clean up while statement in onOptionsItemSelected
This commit is contained in:
parent
fe30dce6f0
commit
be78cc0820
@ -86,37 +86,19 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.open_note -> {
|
R.id.open_note -> displayOpenNoteDialog()
|
||||||
displayOpenNoteDialog()
|
R.id.new_note -> displayNewNoteDialog()
|
||||||
true
|
R.id.rename_note -> displayRenameDialog()
|
||||||
}
|
R.id.share -> shareText()
|
||||||
R.id.new_note -> {
|
R.id.delete_note -> displayDeleteNotePrompt()
|
||||||
displayNewNoteDialog()
|
R.id.settings ->
|
||||||
true
|
|
||||||
}
|
|
||||||
R.id.rename_note -> {
|
|
||||||
displayRenameDialog()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
R.id.share -> {
|
|
||||||
shareText()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
R.id.delete_note -> {
|
|
||||||
displayDeleteNotePrompt()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
R.id.settings -> {
|
|
||||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||||
true
|
R.id.about ->
|
||||||
}
|
|
||||||
R.id.about -> {
|
|
||||||
startActivity(Intent(applicationContext, AboutActivity::class.java))
|
startActivity(Intent(applicationContext, AboutActivity::class.java))
|
||||||
true
|
else -> return super.onOptionsItemSelected(item)
|
||||||
}
|
|
||||||
else -> super.onOptionsItemSelected(item)
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayRenameDialog() {
|
private fun displayRenameDialog() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user