Skip to content

Migrate Snackbar snippets (showing and action) - #1080

Open
hamen wants to merge 5 commits into
android:mainfrom
hamen:hamen/snackbar-showing
Open

hamen wants to merge 5 commits into
android:mainfrom
hamen:hamen/snackbar-showing

Conversation

@hamen

@hamen hamen commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Code snippets are for:

List of modifications:

  • Showing page: Added Kotlin snippets for creating and displaying a Snackbar using Snackbar.make() and .show(), as well as chained invocation (views module).
  • Showing page: Added the CoordinatorLayout skeleton as a layout resource (views module). It declares @+id/myCoordinatorLayout, which the chained Snackbar.make() snippet looks up.
  • Action page: Added Kotlin snippets for Snackbar.setAction with custom OnClickListener and SnackbarHost with SnackbarHostState in Compose (views and compose:snippets modules).

Deviations from the page:

  • The layout snippet uses androidx.coordinatorlayout.widget.CoordinatorLayout. The page shows android.support.design.widget.CoordinatorLayout, which is the Support Library class and is no longer available. The page text needs the same change.
  • The layout snippet drops the unused xmlns:app declaration.

@hamen hamen changed the title Migrate Build and display a pop-up message snippets Migrate Snackbar snippets (showing and action) Sep 10, 2026

@kkuan2011 kkuan2011 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good once comments are addressed, then can you add Aaron for review? and move it out of draft mode?

Comment thread views/src/main/res/values/ids.xml Outdated
The Snackbar snippets call findViewById(R.id.myCoordinatorLayout). The id
came from an ids.xml entry, which declares an id that no layout uses. The
showing page already carries the layout the snippets expect, so migrate
that block too and let it declare the id.

The page still shows android.support.design.widget.CoordinatorLayout. The
snippet uses the AndroidX class.
@hamen
hamen marked this pull request as ready for review September 16, 2026 12:55
@hamen
hamen requested a review from a team as a code owner September 16, 2026 12:55
@hamen
hamen requested a review from rebeccasg September 16, 2026 12:55
@snippet-bot

snippet-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

Here is the summary of changes.

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

@hamen
hamen force-pushed the hamen/snackbar-showing branch from 58deebb to 1ed0555 Compare September 16, 2026 14:41
@kkuan2011
kkuan2011 requested a review from alabiaga September 17, 2026 01:11
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.

2 participants