ADFA-2838: Add jetpack compose preview documentation tooltip#960
ADFA-2838: Add jetpack compose preview documentation tooltip#960Daniel-ADFA merged 3 commits intostagefrom
Conversation
📝 WalkthroughRelease Notes - ADFA-2838: Add Jetpack Compose Preview Documentation Tooltip
Lines changed (approximate):
WalkthroughAdds Compose preview support to PreviewLayoutAction, detects Compose dependency via IProjectManager, refactors prepare()/postExec() to use safe editor/file retrieval and guarded visibility/enabled states, and introduces a new tooltip constant for Compose previews. Changes
Sequence Diagram(s)sequenceDiagram
participant PreviewAction as PreviewLayoutAction
participant ProjManager as IProjectManager
participant Handler as EditorHandlerActivity
participant Editor as Editor/File
rect rgba(100,150,200,0.5)
Note over PreviewAction,Editor: prepare()
PreviewAction->>Editor: request editor from data
Editor-->>PreviewAction: editor / file path or null
end
rect rgba(150,100,200,0.5)
Note over PreviewAction,ProjManager: dependency check
PreviewAction->>ProjManager: moduleUsesCompose(file?) or project-wide check
ProjManager-->>PreviewAction: true / false
end
rect rgba(200,150,100,0.5)
Note over PreviewAction,Handler: postExec()
alt file ends with .xml
PreviewAction->>Handler: invoke XML preview
else file is .kt and Compose available
PreviewAction->>Handler: invoke Compose preview
else no applicable preview
PreviewAction->>PreviewAction: mark action invisible/disabled
end
Handler-->>PreviewAction: preview result
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
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 unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt`:
- Around line 85-90: The catch block around extractPathData in
PreviewLayoutAction currently swallows all Throwables and just calls
markInvisible(); update it to log the exception (at debug or warn level) with
context before calling markInvisible() and returning so failures are
diagnosable; locate the try/catch around extractPathData(...) in
PreviewLayoutAction (the catch handling Throwable err) and add a process or
logger call that includes err and a short message identifying the
file/operation.
🧹 Nitpick comments (1)
app/src/main/java/com/itsaky/androidide/actions/etc/PreviewLayoutAction.kt (1)
109-117: Fallback shows Compose tooltip even for XML files during initialization.When
viewModel.isInitializingis true andfileis non-null (e.g., an.xmlfile), this branch still setspreviewType = COMPOSEif the project uses Compose. The button is disabled so it's not clickable, but the tooltip will briefly show the Compose preview hint instead of the layout preview one until initialization completes andprepare()is re-invoked.If that transient tooltip mismatch is acceptable, feel free to ignore.
No description provided.