material-components / material-components/material-components-android
[Snackbar] Override Default Snackbar animation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Limited snackbar animations - Slide or Fade
**Describe the solution you'd like**
I would like to use a custom animation through theme, xml or `setAnimation`
**Describe alternatives you've considered**
Currently I need to create a whole Snackbar class to override it or use it through custom views and visibilty handling of the default animation
Current `animateView` is fixed to one of these two options. I would like to add my custom animation somehow:
```
void animateViewIn() {
// Post to make sure animation doesn't start until after all inset handling has completed
view.post(
new Runnable() {
@Override
public void run() {
if (view == null) {
return;
}
// Make view VISIBLE now that we are about to start the enter animation
view.setVisibility(View.VISIBLE);
if (view.getAnimationMode() == ANIMATION_MODE_FADE) {
startFadeInAnimation();
} else {
startSlideInAnimation();
}
}
});
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Snackbar's animateViewIn(), startFadeInAnimation(), and startSlideInAnimation() entry points shown in the issue. Clarify how a custom animation should be supplied through theme, XML, or setAnimation, and define completion as using that animation without replacing Snackbar or manually managing visibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100