mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-24 12:30:07 +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()
|
val isCurrentItemChecklist = isCurrentItemChecklist()
|
||||||
|
|
||||||
main_toolbar.menu.apply {
|
main_toolbar.menu.apply {
|
||||||
val areButtonsVisible = (showRedoButton || showUndoButton) && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
|
||||||
findItem(R.id.undo).apply {
|
findItem(R.id.undo).apply {
|
||||||
isVisible = areButtonsVisible
|
isVisible = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||||
isEnabled = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
|
||||||
icon?.alpha = if (isEnabled) 255 else 127
|
icon?.alpha = if (isEnabled) 255 else 127
|
||||||
}
|
}
|
||||||
|
|
||||||
findItem(R.id.redo).apply {
|
findItem(R.id.redo).apply {
|
||||||
isVisible = areButtonsVisible
|
isVisible = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
||||||
isEnabled = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
|
|
||||||
icon?.alpha = if (isEnabled) 255 else 127
|
icon?.alpha = if (isEnabled) 255 else 127
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user