ADFA-3717: Render inactive toolbar actions as disabled instead of hidden#1181
ADFA-3717: Render inactive toolbar actions as disabled instead of hidden#1181Daniel-ADFA wants to merge 1 commit intostagefrom
Conversation
📝 WalkthroughToolbar Action Visibility Changes
Risk Assessment
Best Practice Concern: This represents a semantic shift in how WalkthroughA filtering condition in the toolbar menu construction logic of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt (1)
434-444:⚠️ Potential issue | 🟠 MajorDo not allow
visible=falseactions to remain executable from the toolbar.After removing the visibility gate, any action with
visible=falsebutenabled=truecan now render and execute via toolbar click. That breaks the UI/behavior contract. If the goal is “show inactive actions as disabled,” compute a UI-enabled state from both flags and gate alpha/click with it.Suggested patch
action.prepare(data) if (action.id in hiddenIds) return@onEachIndexed + val isUiEnabled = action.visible && action.enabled action.icon?.apply { colorFilter = action.createColorFilter(data) - alpha = if (action.enabled) 255 else 76 + alpha = if (isUiEnabled) 255 else 76 } content.projectActionsToolbar.addMenuItem( icon = action.icon, hint = getToolbarContentDescription(action, data), - onClick = { if (action.enabled) registry.executeAction(action, data) }, + onClick = { if (isUiEnabled) registry.executeAction(action, data) },Based on learnings: in
app/src/main/java/com/itsaky/androidide/shortcuts/IdeShortcutActions.kt,visibleis intentionally UI-only whileenabledgoverns execution, so execution should not bypass UI visibility semantics.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt` around lines 434 - 444, The toolbar currently lets actions with visible=false but enabled=true be clicked; change the UI logic to compute a UI-enabled flag (e.g., val uiEnabled = action.visible && action.enabled) and use that for rendering and click gating: apply the alpha based on uiEnabled (255 vs 76) and change the onClick to guard with uiEnabled before calling registry.executeAction(action, data). Keep the existing hiddenIds check (action.id in hiddenIds) as-is to still omit fully hidden items; update references in the projectActionsToolbar.addMenuItem call and any uses of action.enabled in this block to use uiEnabled instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In
`@app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt`:
- Around line 434-444: The toolbar currently lets actions with visible=false but
enabled=true be clicked; change the UI logic to compute a UI-enabled flag (e.g.,
val uiEnabled = action.visible && action.enabled) and use that for rendering and
click gating: apply the alpha based on uiEnabled (255 vs 76) and change the
onClick to guard with uiEnabled before calling registry.executeAction(action,
data). Keep the existing hiddenIds check (action.id in hiddenIds) as-is to still
omit fully hidden items; update references in the
projectActionsToolbar.addMenuItem call and any uses of action.enabled in this
block to use uiEnabled instead.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e67292d9-4db5-4d8a-804f-6ff85cbc6229
📒 Files selected for processing (1)
app/src/main/java/com/itsaky/androidide/activities/editor/EditorHandlerActivity.kt
Screen_recording_20260414_230923.webm