Add snippets for focus management in Compose#560
Draft
chikoski wants to merge 5 commits intoandroid:mainfrom
Draft
Add snippets for focus management in Compose#560chikoski wants to merge 5 commits intoandroid:mainfrom
chikoski wants to merge 5 commits intoandroid:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a set of Compose snippets demonstrating focus management use-cases and wires them into the existing snippets navigation.
- Adds new focus snippets covering request focus, focus movement, focus state, focus traversal, and focus targets.
- Extends the navigation graph (
Destination.ktandSnippetsActivity.kt) to include a new FocusExamples screen and its sub-routes. - Refactors visibility and imports in
FocusSnippets.ktto expose snippet functions and update snippet identifiers.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
touchinput/focus/RequestFocus.kt |
New snippet for requesting focus and redirection |
touchinput/focus/MoveFocus.kt |
New snippet for advancing and clearing focus with ESC |
touchinput/focus/FocusedState.kt |
New snippet for applying ripples based on focus state |
touchinput/focus/FocusTraversal.kt |
New 1D/2D focus traversal examples and overrides |
touchinput/focus/FocusTarget.kt |
New snippet showing which UI elements are focus targets |
touchinput/focus/FocusSnippets.kt |
Hosts all focus snippet UIs, updated visibilities and imports |
navigation/Destination.kt |
Added FocusExamples enum and entries |
SnippetsActivity.kt |
Registered the new FocusExamples routes |
Comments suppressed due to low confidence (1)
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTarget.kt:122
- This snippet ID is duplicated in
InteractiveUiElementIsFocusTargets; consider giving each snippet a unique tag to avoid collisions in generated docs.
// [START android_compose_touchinput_focus_target_interactive_ui_element]
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTraversal.kt
Outdated
Show resolved
Hide resolved
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTraversal.kt
Outdated
Show resolved
Hide resolved
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTraversal.kt
Outdated
Show resolved
Hide resolved
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTraversal.kt
Outdated
Show resolved
Hide resolved
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTraversal.kt
Outdated
Show resolved
Hide resolved
compose/snippets/src/main/java/com/example/compose/snippets/touchinput/focus/FocusTraversal.kt
Outdated
Show resolved
Hide resolved
Contributor
|
@chikoski is this PR still relevant? If so, please assign the right reviewer and update. |
Contributor
|
Closing for now, please re-open if needed. |
Contributor
Author
|
@JolandaVerhoef Apologies for my delayed response. Would you please take a look? |
Contributor
Author
|
Let me update and come back to you. |
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.
This pull request add some snippets about focus management