ADFA-4500 | Show snippet dialogs and toasts through PluginWindows - #83
Open
Daniel-ADFA wants to merge 2 commits into
Open
ADFA-4500 | Show snippet dialogs and toasts through PluginWindows#83Daniel-ADFA wants to merge 2 commits into
Daniel-ADFA wants to merge 2 commits into
Conversation
Undocking Snippets into a floating window and tapping Add crashed the app, and saving a filled-in snippet crashed it again after the file had already been written. An undocked fragment runs against a window context created for TYPE_APPLICATION_OVERLAY, and the platform requires every window added through it to carry that type. MaterialAlertDialogBuilder(ctx).show() builds a TYPE_APPLICATION window and Toast.makeText a TYPE_TOAST one, so both threw IllegalArgumentException while floating. Docked, ctx is the activity, so the same code worked. Route both through PluginWindows: showDialog applies the type the context requires, showToast posts against the application context, which imposes no window type. Both are no-ops while docked, so a single call site is correct in either state. Applied to both dialogs (the editor and the delete confirmation) and all three toasts. min_ide_version moves to 26.36, the release that ships PluginWindows.
Daniel-ADFA
marked this pull request as ready for review
September 2, 2026 08:07
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
jatezzz
requested changes
Sep 2, 2026
Review feedback: user-facing text belongs in resources. Covers every user-facing literal in the two functions this PR touches, not only the three toasts flagged, so the file is not left half converted: the editor and delete dialog titles, their Save/Cancel/Delete buttons and the delete confirmation, alongside the validation and save toasts. The delete confirmation takes the prefix as a positional argument rather than interpolating it. The Log.e message is left as it is; it is not user-facing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plugin half of ADFA-4500. Host PR: appdevforall/CodeOnTheGo#1771.
Blocked until the host lands
This does not compile against the current
libs/plugin-api.jar, which has noPluginWindows. It needs CodeOnTheGo#1771 merged and achore: update libsrefresh first. Draft until then.What was wrong
Undocking Snippets into a floating window and tapping Add crashed the app. After that was fixed host-side, saving a filled-in snippet crashed it again, after the file had already been written, so the snippet persisted and the process died.
An undocked fragment runs against a window context created for
TYPE_APPLICATION_OVERLAY, and the platform requires every window added through it to carry that same type.MaterialAlertDialogBuilder(ctx).show()builds aTYPE_APPLICATIONwindow andToast.makeTextaTYPE_TOASTone, so both threwIllegalArgumentExceptionwhile floating:Docked,
ctxis the activity, so the same code worked. That is why this only ever reproduced undocked.Change
Both dialogs and all three toasts go through
PluginWindows. Dialogs are built withcreate()and shown viashowDialog; toasts useshowToast, which posts against the application context. Both are no-ops while docked, so one call site is correct in either state.min_ide_versionmoves from1.0.0to26.36, the release that shipsPluginWindows.Sites changed
showEditorMaterialAlertDialogBuilder(ctx).show()confirmDeleteMaterialAlertDialogBuilder(ctx).show()showEditorvalidationToast.makeText(ctx, ...)savesuccessToast.makeText(requireContext(), ...)savefailureToast.makeText(requireContext(), ...)No remaining
Toast.makeTextorandroid.widget.Toastimport in the file.Verification
Device (arm64 emulator, API 36), against a host build of CodeOnTheGo#1771:
Window type mismatch, zero fatals.