mirror of
				https://github.com/SimpleMobileTools/Simple-Notes.git
				synced 2025-06-05 17:00:23 +02:00 
			
		
		
		
	simplify undo/redo menu button visibility checks
This commit is contained in:
		| @@ -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 | ||||
|             } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user