Skip to content

Conversation

dturner
Copy link
Contributor

@dturner dturner commented May 20, 2025

Add snippets for Jetpack Navigation3 docs.

JolandaVerhoef and others added 15 commits April 29, 2025 09:45
* Refactor swipe-to-dismiss examples

- Update TodoItem data class for better readability
- Refactor the swipe item to improve the overall performance and readability
- Refactor SwipeItemExample for better readability
- Refactor SwipeCardItemExample and rename it to SwipeItemWithAnimationExample for better description
- Modify the swipe to dismiss animation for better user experience
- Add comments to make code easy to read

* Apply Spotless

---------

Co-authored-by: JolandaVerhoef <[email protected]>
* Add new and updated accessibility DAC snippets

* Import hideFromAccessibility

* Apply Spotless

* Revert removal of some existing a11y snippets
* Migrate existing snippets to alpha04
* Add snippet for Session resume
* Add SpatialExternalSurface snippet for xr-alpha04 and update SNAPSHOT build version.
* Fix up Subspaces and Environments for alpha04
* Update SpatialExternalSurface example for xr-alpha04
* Add comments for SpatialExternalSurface in xr-alpha04
* Fix Anchor configuration snippet
* Migrate to alpha04 (from snapshot build)

---------

Co-authored-by: devbridie <[email protected]>
Co-authored-by: Jan Kleinert <[email protected]>
* 🤖 Update Dependencies

* revert the window dep update

* Apply Spotless

* Revert the revert

* Suppress requiresSdk warnings

* Suppress requiresSdk warnings

* Revert xr deps

---------

Co-authored-by: Simona Milanovic <[email protected]>
Co-authored-by: simona-anomis <[email protected]>
* Update to 1.5.0-beta01

Change-Id: I5acad074c6dc067b10d37ff1416c671e7c9c91b9

* Apply Spotless

---------

Co-authored-by: kul3r4 <[email protected]>
… completeness (#517)

* Fix scrollState for List and expand the snippet to show kore code for completeness

* Apply Spotless

---------

Co-authored-by: kul3r4 <[email protected]>
* Properly handle recycling of RecomposeHighlighterModifier

After migrating to be Node based, it's possible the Modifier node can be reused. For example, when scrolling in a LazyColumn the nodes of items scrolled off the viewport may be recycled and used with items scrolling into the viewport. When this occurs, the composition count needs to be reset. Otherwise, it may look like the item scrolling into the viewport has recomposed more than it actually has.

* Fix code style
* State based TF snippets

* Apply Spotless

* updates

* Apply Spotless

* Update StateBasedText.kt

* Update StateBasedText.kt

* Update StateBasedText.kt

* Update StateBasedText.kt

* Apply Spotless
* Adding icon button snippets

* Apply Spotless

* Changing M3 extended icons to hardcoded drawables in IconButton code

* Apply Spotless

* Adding region tags

* Remove unused import

* Updating to hardcoded drawables

* Apply Spotless

---------

Co-authored-by: wardlauren <[email protected]>
* Adding snippet for MV-HEVC video playback

* updating the resizable snippet to include ResizeListener
* Adding TextField migration snippets

This is for the new version of https://developer.android.com/develop/ui/compose/text/user-input

* Update TextFieldMigrationSnippets.kt

optimize import

* Apply Spotless

---------

Co-authored-by: Halil Ozercan <[email protected]>
* Add state based Autofill snippets

* Update AutofillSnippets.kt

* Apply Spotless
* Update StateBasedText.kt

Update state based TF snippets

* Apply Spotless

* Update StateBasedText.kt

* Apply Spotless
Copy link

snippet-bot bot commented May 20, 2025

Here is the summary of changes.

You are about to add 197 region tags.
You are about to delete 24 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

devbridie added 2 commits May 22, 2025 10:46
* Add snippet that demonstrates how to detect a secondary hand

* Add snippet to demonstrate how to detect a basic stop gesture
* Change SceneViewer intent setup
IanGClifton and others added 10 commits June 12, 2025 09:37
This addresses #533 by recreating the Animatable when the node is attached.
* updating setSubspaceContent snippet

* Update Activity

---------

Co-authored-by: Dereck Bridie <[email protected]>
* Update android_system_bar_protection_kotlin to change alpha

* show less code in DAC

* use Color.rgb instead
* Fix code to also support external apps

* Sort chronologically the snippets

* Move the Activity to be used without the nullability check

---------

Co-authored-by: Rob Orgiu <[email protected]>
* Add comment to clarify that both callbacks can be used

* Apply Spotless

---------

Co-authored-by: Rob Orgiu <[email protected]>
Co-authored-by: tiwiz <[email protected]>
khufdev and others added 28 commits August 26, 2025 08:33
…594)

Moved the modifier parameter in the CustomizableSearchBar composable
to be the first optional parameter, adhering to Jetpack Compose API guidelines.
The lint tool reported a "UseKtx" warning in StateBasedText.kt.
The code was using the static `TextUtils.isDigitsOnly()` method.

This commit refactors the code to use the more idiomatic
`isDigitsOnly()` Kotlin extension function from the Android KTX library.
)

The lint tool reported "ComposableNaming" warnings in GlanceSnippets.kt.
Composable functions that return Unit should be named using PascalCase,
like classes, to clearly identify them as UI components.

This commit renames 12 Composable functions to adhere to this convention.
For example, `actionLambda` has been renamed to `ActionLambda`.
This improves code readability and follows Compose best practices.
* Perf: Use specialized state holders to avoid autoboxing

The lint tool reported "AutoboxingStateCreation" warnings in multiple files.
Using the generic `mutableStateOf` for primitive types (Int, Float, Long)
can lead to performance overhead due to autoboxing.

This commit resolves these warnings by replacing `mutableStateOf`
with its specialized, more performant counterparts (`mutableIntStateOf`,
`mutableFloatStateOf`, `mutableLongStateOf`) where applicable.
This change improves performance by avoiding unnecessary object allocations
for primitive state values.
)

The lint tool reported a "ReturnFromAwaitPointerEventScope" warning
in KotlinSnippets.kt.
Returning a value from this scope can lead to dropped input events
due to the way pointer event queues are handled.

This commit resolves the warning by moving the animation logic,
which depends on the tap position, directly inside the
awaitPointerEventScope block.
This ensures that the event data is processed immediately
within the correct context, preventing potential event loss.
The lint tool reported an "ImplicitSamInstance" warning in PictureInPictureSnippets.kt. Lambdas used as listeners were being implicitly converted to new SAM instances, causing removeOnUserLeaveHintListener to fail because the listener instances did not match. This could lead to a memory leak.

This commit fixes the issue by explicitly wrapping the listener lambdas in a 'Runnable' instance. This ensures a stable object reference is used for both adding and removing the listener.
)

The lint tool reported warnings for `ModifierNodeElement` classes
missing an override for `inspectableProperties`.
This function is used by development tools like the
Layout Inspector to display debug information.

Rather than implementing the function directly and adding complexity
to the existing minimal snippets, this commit adds `TODO` comments.
This serves as a reminder to create a dedicated snippet that demonstrates
how to properly implement `inspectableProperties`,
thereby keeping the current examples focused and clean while still
addressing the lint warning.
* Add kotlin gitignore

* Add KMP shared module

* Add xcode gitignore

* Add kmp ios app

* Add KMP ViewModel

* Fix ios build

* Add viewmodel snippet

* Move to directory

* Move kmp to :shared

* Add KMP regions

* Add swift content

* Add comments with file path

* Add build-ios workflow

* Fix concurrency

* Apply Spotless

---------

Co-authored-by: mlykotom <[email protected]>
* Fix missing snippet

* Apply Spotless

---------

Co-authored-by: mlykotom <[email protected]>
* Add viewmodel screen for KMP

* Apply Spotless

* Fix snippets by adding compose compiler

* Add androidApp to prevent Compose issue

---------

Co-authored-by: mlykotom <[email protected]>
* Disabling some "unused" warnings

I'd submitted code that's never actually used in the android/snippets apps. Ideally we'd include it in an app, but in the meantime, disabling the "unused" warnings.

Also removed one line (outside of a published-on-DAC code block) that turned out not to be needed.

No changes to the code that's included on DAC, and the code still compiles.

(I also see some areas where the actual code snippet used on DAC is generating warnings, but I'll resolve those in separate PRs that can be reviewed by the appropriate SMEs for those docs.)
* Resolve warnings in the Wakelock code snippets

I was getting code warnings in Android Studio, made some minor changes to resolve them:

  * used WakeLock.acquire(timeout) instead of acquire()
  * removed the redundant qualifier for POWER_SERVICE

Once this PR is approved, I'll set up a corresponding docs CL to update the description to explain the acquire() parameter.

* Apply Spotless

* Per Alice's suggestion, used constant casing for the wakelock timeout (wlTimeout -> WAKELOCK_TIMEOUT)
* add WindowInsetsRulers snippet
* Update StateBasedText.kt

* Update StateBasedText.kt

* Update StateBasedText.kt

* Apply Spotless

* Update StateBasedText.kt

* Update StateBasedText.kt
* Adding shadows code snippets

* Apply Spotless

* Moving @Preview before code tags and updating ELevationBasedShadow()

* Apply Spotless

* Adding delay import

---------

Co-authored-by: wardlauren <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.