arch(navigation): support generating raw Intents#21112
Open
david-allison wants to merge 4 commits into
Open
Conversation
The Android Studio sidebar shows 'kotlin' instead of 'java+kotlin'
Rarely, a raw intent is required (PendingIntent, TaskStackBuilder, ShortcutInfo etc...) This is gated on `DeferredNavigation` to encourage callers to use `navigate` Test classes implement the interface for brevity Part of 20737 Assisted-by: Claude Opus 4.7
f6379bc to
12dae06
Compare
As a context parameter, it was inside a `Fragment` which caused ambiguity. It's better as an extension method
Useful extension method to support a `Destination` Assisted-by: Claude Opus 4.7
0af025c to
38cb97a
Compare
criticalAY
approved these changes
May 22, 2026
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.
Note
Assisted-by: Claude Opus 4.7
Purpose / Description
When extracting widgets to a submodule, we have some
pendingIntentusages.navigate()can't be used and instead a rawIntentis required, but we do not want the navigation framework to exposeDestionation.toIntent()by default.Anki-Android/AnkiDroid/src/main/java/com/ichi2/widget/AddNoteWidget.kt
Lines 49 to 53 in 22c565c
Fixes
Approach
We offer a gated method to allow this escape hatch, using my favourite feature: context parameters.
The definitions allow this code to work as expected, while
destination.toIntent()is still undefined.How Has This Been Tested?
commit 1
commit 2
Not necessary - code convention only
Checklist