mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-19 10:00:16 +01:00
simplify undo/redo menu button visibility checks
This commit is contained in:
parent
ee3abd2577
commit
1acda068af
@ -167,16 +167,13 @@ class MainActivity : SimpleActivity() {
|
||||
val isCurrentItemChecklist = isCurrentItemChecklist()
|
||||
|
||||
main_toolbar.menu.apply {
|
||||
val areButtonsVisible = (showRedoButton || showUndoButton) && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||
findItem(R.id.undo).apply {
|
||||
isVisible = areButtonsVisible
|
||||
isEnabled = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||
isVisible = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||
icon?.alpha = if (isEnabled) 255 else 127
|
||||
}
|
||||
|
||||
findItem(R.id.redo).apply {
|
||||
isVisible = areButtonsVisible
|
||||
isEnabled = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||
isVisible = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||
icon?.alpha = if (isEnabled) 255 else 127
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user