Skip to content

Commit 1acda06

Browse files
committed
simplify undo/redo menu button visibility checks
1 parent ee3abd2 commit 1acda06

File tree

1 file changed

+2
-5
lines changed
  • app/src/main/kotlin/com/simplemobiletools/notes/pro/activities

1 file changed

+2
-5
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/activities/MainActivity.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,13 @@ class MainActivity : SimpleActivity() {
167167
val isCurrentItemChecklist = isCurrentItemChecklist()
168168

169169
main_toolbar.menu.apply {
170-
val areButtonsVisible = (showRedoButton || showUndoButton) && mCurrentNote.type == NoteType.TYPE_TEXT.value
171170
findItem(R.id.undo).apply {
172-
isVisible = areButtonsVisible
173-
isEnabled = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
171+
isVisible = showUndoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
174172
icon?.alpha = if (isEnabled) 255 else 127
175173
}
176174

177175
findItem(R.id.redo).apply {
178-
isVisible = areButtonsVisible
179-
isEnabled = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
176+
isVisible = showRedoButton && mCurrentNote.type == NoteType.TYPE_TEXT.value
180177
icon?.alpha = if (isEnabled) 255 else 127
181178
}
182179

0 commit comments

Comments
 (0)