Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added snippet for AnimatedVisibility usage with Shared elements #272

Merged
merged 10 commits into from
May 24, 2024

Conversation

riggaroo
Copy link
Collaborator

@riggaroo riggaroo commented May 20, 2024

As well as snippets for CompositionLocal usage.

animated_visibility_lazy_column_shorter.mp4

Copy link

snippet-bot bot commented May 20, 2024

Here is the summary of changes.

You are about to add 3 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

import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.compose.snippets.R

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file only for one snippet? It looks like there are a lot of parts needed to have this code work - is there enough context in the documentation for the developer to understand everything needed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, it had an example with the blurring and without blurring, i've moved the blurring full snippet to another snippet file that wont be referenced on DAC. and simplified this one.

Copy link
Contributor

@MagicalMeghan MagicalMeghan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just one question

private fun <T> animationSpec() = tween<T>(durationMillis = 500)
private val boundsTransition = BoundsTransform { _, _ -> animationSpec() }
private val shapeForSharedElement = RoundedCornerShape(16.dp)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have this in snippets if its not going on DAC?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to point people to it as an advanced example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ie from Twitter or a video etc.

@riggaroo riggaroo merged commit 960f6de into latest May 24, 2024
4 checks passed
@riggaroo riggaroo deleted the feature/animated-visibility-shared-elements branch May 24, 2024 12:19
riggaroo added a commit that referenced this pull request Sep 6, 2024
* Add snippets for Indication and Ripple migration (#191)

* Add ripple snippets.

* Add new ripple APIs.

* Add snippets for interactions.

* Added more ripple snippets.

* Update foundation and material to 1.7.0-alpha01

* Fix snippet tag.

* Apply Spotless

---------

Co-authored-by: arriolac <arriolac@users.noreply.github.com>

* Convert NeonIndication to data class. (#193)

* Adding pip snippets to latest branch (#196)

* Adding pip snippets to latest branch

* Apply Spotless

* Adding pip snippets to latest

---------

Co-authored-by: MagicalMeghan <MagicalMeghan@users.noreply.github.com>

* Delete pictureInPicture. (#213)

* Update activity compose level and align log tag with main branch (#215)

* Migrate recomposeHighlighter to Modifier.Node (#197) (#238)

* Migrate recomposeHighlighter to Modifier.Node

* Apply Spotless

* Simplify recompose highlighter

* Apply Spotless

---------

Co-authored-by: Tomáš Mlynarič <mlykotom@google.com>
Co-authored-by: mlykotom <mlykotom@users.noreply.github.com>

* Adding samples for ContextualFlowRow  (#234)

* Add snippets for ContextualFlowRow

* Apply Spotless

* Update flow snippets

* Apply Spotless

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Update libs.versions.toml (#247) (#248)

Update Compose BOM to 2024.04.00

Co-authored-by: MagicalMeghan <46006059+MagicalMeghan@users.noreply.github.com>

* Update Bitmap to image snippet to use new Graphics Layers (#254)

* Update libs.versions.toml (#251)

* Replace Graphics bitmap snippets with new Graphics Layer snippets.

* Replace Graphics bitmap snippets with new Graphics Layer snippets.

* Apply Spotless

---------

Co-authored-by: Simona <35065668+simona-anomis@users.noreply.github.com>
Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* add shared element snippets

* Apply Spotless

* Split snippets into different files.

* Apply Spotless

* Shared element snippets (#256)

* add shared element snippets

* Apply Spotless

* Split snippets into different files.

* Apply Spotless

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Update libs.versions.toml (#251) (#252)

Co-authored-by: Simona <35065668+simona-anomis@users.noreply.github.com>

* Snippet updates based on peer feedback.

* Shared element snippets (#258)

* add shared element snippets

* Apply Spotless

* Split snippets into different files.

* Apply Spotless

* Snippet updates based on peer feedback.

* Apply Spotless

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Unique key snippet

* Update SharedElementsWithNavigationSnippets.kt

* Update AsyncImage snippet

* Add placeholder size example

* Add comment to  snippet about unmatched bounds

* 🤖 Sync main to latest (#259)

* Update libs.versions.toml (#251)

* Updated ListDetailPaneScaffold use to alpha12 (#255)

This eliminates storing state outside and directly uses the navigator as
the source of truth. This also gets rid of the Modifier for AnimatedPane
as it's no longer a required argument.

* Added NavigationSuiteScaffold snippets (#261)

* Added NavigationSuiteScaffold snippets

* Apply Spotless

* 🤖 Update Dependencies (#262)

* Added snippets for SupportingPaneScaffold (#260)

* Added snippets for SupportingPaneScaffold
* Apply Spotless
* Update compose/snippets/src/main/java/com/example/compose/snippets/adaptivelayouts/SampleSupportingPaneScaffold.kt

* Migrate to material3-adaptive WindowSizeClass method (#264)

* Migrate to material3-adaptive WindowSizeClass method

* Update comments to be single line

* Apply Spotless

---------

Co-authored-by: Simona <35065668+simona-anomis@users.noreply.github.com>
Co-authored-by: Ian G. Clifton <1033551+IanGClifton@users.noreply.github.com>
Co-authored-by: Alex Vanyo <vanyo@google.com>
Co-authored-by: compose-devrel-github-bot <compose-devrel-github-bot@users.noreply.github.com>

* Update to new lazy list snippets. (#265)

* Compose - beta01 (#270)

* Update to new beta01 version

* Apply Spotless

* Update shared element text composable

* Apply Spotless

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Added snippet for AnimatedVisibility usage with Shared elements (#272)

* Added AnimatedVisibility shared element examples.

* Apply Spotless

* Switch to using LazyColumn instead of Grid as it has better animation support at present.

* Apply Spotless

* Fixed import.

* Apply Spotless

* Seperate samples into different files, simplify snippet.

* Apply Spotless

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Add clickable text snippets (#297)

* 🤖 Sync main to latest (#266)

* Update CenterAlignedTopAppBar snippet to use centerAlignedTopAppBarColors

* Time pickers comments (#295)

* Adding advanced examples

* Apply Spotless

* Adding advanced examples

* Rename AdvancedTimePickerExample

* Rename AdvancedTimePickerExample

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Adds preview and breakpoint

---------

Co-authored-by: Jamal Eason <jamal.eason@gmail.com>
Co-authored-by: Jake Roseman <122034773+jakeroseman@users.noreply.github.com>
Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>
Co-authored-by: Kat Kuan <843428+kkuan2011@users.noreply.github.com>
Co-authored-by: Chiara Chiappini <cchiappini@google.com>
Co-authored-by: Chiara Chiappini <nunca.aqui@gmail.com>

* 🤖 Sync main to latest (#301)

* Update CenterAlignedTopAppBar snippet to use centerAlignedTopAppBarColors

* Time pickers comments (#295)

* Adding advanced examples

* Apply Spotless

* Adding advanced examples

* Rename AdvancedTimePickerExample

* Rename AdvancedTimePickerExample

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Adds preview and breakpoint

* Updating DeviceConfigurationOverride snippet comment (#232)

* Timepickers redux (#296)

* Reworking the time picker examples to be more friendly to copy-pasting

* Apply Spotless

* Updating the time picker examples to be more copy-pastable

* Change in-use tag name back to the current form.

* Apply Spotless

* Renaming region tags

* Renaming region tags

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Date pickers (#302)

* Reworking the time picker examples to be more friendly to copy-pasting

* Apply Spotless

* Updating the time picker examples to be more copy-pastable

* Change in-use tag name back to the current form.

* Apply Spotless

* Renaming region tags

* Renaming region tags

* Adding date picker snippets

* Apply Spotless

* fixing region tags

* Adding additional range tags

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Break long instruction in 2 lines to optimize for DAC

* Prevent redrawing twice and running timer when compositions =0 (#304)

---------

Co-authored-by: Jamal Eason <jamal.eason@gmail.com>
Co-authored-by: Jake Roseman <122034773+jakeroseman@users.noreply.github.com>
Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>
Co-authored-by: Kat Kuan <843428+kkuan2011@users.noreply.github.com>
Co-authored-by: Chiara Chiappini <cchiappini@google.com>
Co-authored-by: Chiara Chiappini <nunca.aqui@gmail.com>
Co-authored-by: Alex Vanyo <vanyo@google.com>
Co-authored-by: Tomáš Mlynarič <mlykotom@google.com>

* Snippet updates for type safe navigation APIs

* Downgrade compileSdk to 34

* 🤖 Sync main to latest (#313)

* Update CenterAlignedTopAppBar snippet to use centerAlignedTopAppBarColors

* Time pickers comments (#295)

* Adding advanced examples

* Apply Spotless

* Adding advanced examples

* Rename AdvancedTimePickerExample

* Rename AdvancedTimePickerExample

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Adds preview and breakpoint

* Updating DeviceConfigurationOverride snippet comment (#232)

* Timepickers redux (#296)

* Reworking the time picker examples to be more friendly to copy-pasting

* Apply Spotless

* Updating the time picker examples to be more copy-pastable

* Change in-use tag name back to the current form.

* Apply Spotless

* Renaming region tags

* Renaming region tags

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Date pickers (#302)

* Reworking the time picker examples to be more friendly to copy-pasting

* Apply Spotless

* Updating the time picker examples to be more copy-pastable

* Change in-use tag name back to the current form.

* Apply Spotless

* Renaming region tags

* Renaming region tags

* Adding date picker snippets

* Apply Spotless

* fixing region tags

* Adding additional range tags

---------

Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>

* Break long instruction in 2 lines to optimize for DAC

* Prevent redrawing twice and running timer when compositions =0 (#304)

* Allow Spotless to make commits on a user's behalf (#312)

See diffplug/spotless#1242

---------

Co-authored-by: Jamal Eason <jamal.eason@gmail.com>
Co-authored-by: Jake Roseman <122034773+jakeroseman@users.noreply.github.com>
Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>
Co-authored-by: Kat Kuan <843428+kkuan2011@users.noreply.github.com>
Co-authored-by: Chiara Chiappini <cchiappini@google.com>
Co-authored-by: Chiara Chiappini <nunca.aqui@gmail.com>
Co-authored-by: Alex Vanyo <vanyo@google.com>
Co-authored-by: Tomáš Mlynarič <mlykotom@google.com>
Co-authored-by: Jolanda Verhoef <JolandaVerhoef@users.noreply.github.com>

* Latest beta06 updates for Compose (#300)

* Do latest 1.7.0-beta06 version updates

* Apply Spotless

* Code cleanup

* Apply Spotless

* Fix broken test

* Fix tests

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Migrate CompositionLocal snippets to m3 (#321) (#323)

Co-authored-by: Ben Trengrove <bentrengrove@users.noreply.github.com>

* Update snippets to use material3-adaptive rc01 (#324)

* Migrate many snippets to use Material 3 instead of Material 2.  (#320)

* Do latest 1.7.0-beta06 version updates

* Apply Spotless

* Code cleanup

* Apply Spotless

* Fix broken test

* Remove M2 usage from many snippets.

* Apply Spotless

* Remove M2 usage from many snippets.

* Remove M2 usage from many snippets.

* Revert incorrect commit

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Revert shape changes for now.

* Fix text snippets in latest (#326)

* Fix text snippets in latest

* Apply Spotless

* 🤖 Sync main to latest (#327)

* Migrate CompositionLocal snippets to m3 (#321)

* Migrate Custom design system page to M3 (#325)

* Migrate Custom design system page to M3

* Apply Spotless

---------

Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

---------

Co-authored-by: Ben Trengrove <bentrengrove@users.noreply.github.com>
Co-authored-by: Rebecca Franks <riggaroo@google.com>
Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>

* Updating DeviceConfigurationOverride snippet comment (#232)

(cherry picked from commit a84c80d)

* Bump actions/checkout from 3 to 4 (#222)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 2f34f3b)

* Create dependabot.yml (#218)

(cherry picked from commit db5ffc0)

* Bump stefanzweifel/git-auto-commit-action from 4 to 5 (#221)

Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 4 to 5.
- [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases)
- [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md)
- [Commits](stefanzweifel/git-auto-commit-action@v4...v5)

---
updated-dependencies:
- dependency-name: stefanzweifel/git-auto-commit-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit d8ef2dd)

* Bump actions/setup-java from 2 to 4 (#220)

Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2 to 4.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit cea0c7d)

* Set git config user for sync_main_latest workflow. (#230)

* Set git config user for sync_main_latest workflow.

* Update PR description.

(cherry picked from commit ad9ffb0)

* Fix merge

* Fix merge

* Apply Spotless

* Fix merge

---------

Co-authored-by: Chris Arriola <carriola@google.com>
Co-authored-by: arriolac <arriolac@users.noreply.github.com>
Co-authored-by: MagicalMeghan <46006059+MagicalMeghan@users.noreply.github.com>
Co-authored-by: MagicalMeghan <MagicalMeghan@users.noreply.github.com>
Co-authored-by: compose-devrel-github-bot <compose-devrel-github-bot@google.com>
Co-authored-by: compose-devrel-github-bot <118755852+compose-devrel-github-bot@users.noreply.github.com>
Co-authored-by: Tomáš Mlynarič <mlykotom@google.com>
Co-authored-by: mlykotom <mlykotom@users.noreply.github.com>
Co-authored-by: riggaroo <riggaroo@users.noreply.github.com>
Co-authored-by: Simona <35065668+simona-anomis@users.noreply.github.com>
Co-authored-by: Ian G. Clifton <1033551+IanGClifton@users.noreply.github.com>
Co-authored-by: Alex Vanyo <vanyo@google.com>
Co-authored-by: compose-devrel-github-bot <compose-devrel-github-bot@users.noreply.github.com>
Co-authored-by: Ben Trengrove <bentrengrove@users.noreply.github.com>
Co-authored-by: Jamal Eason <jamal.eason@gmail.com>
Co-authored-by: Jake Roseman <122034773+jakeroseman@users.noreply.github.com>
Co-authored-by: jakeroseman <jakeroseman@users.noreply.github.com>
Co-authored-by: Kat Kuan <843428+kkuan2011@users.noreply.github.com>
Co-authored-by: Chiara Chiappini <cchiappini@google.com>
Co-authored-by: Chiara Chiappini <nunca.aqui@gmail.com>
Co-authored-by: Don Turner <donturner@google.com>
Co-authored-by: Don Turner <dturner@users.noreply.github.com>
Co-authored-by: Jolanda Verhoef <JolandaVerhoef@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

3 participants