Skip to content

Commit

Permalink
[TopAppBar] Fixed that liftOnScrollColor doesn't respect to setLifted…
Browse files Browse the repository at this point in the history
… when liftOnScroll is set to false.

Resolves #3523

PiperOrigin-RevId: 563829477
  • Loading branch information
pekingme authored and leticiarossi committed Sep 8, 2023
1 parent 79a1953 commit 43242f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/java/com/google/android/material/appbar/AppBarLayout.java
Expand Up @@ -1018,11 +1018,12 @@ boolean setLiftedState(boolean lifted, boolean force) {
if (force && this.lifted != lifted) {
this.lifted = lifted;
refreshDrawableState();
if (liftOnScroll && isLiftOnScrollCompatibleBackground()) {
if (isLiftOnScrollCompatibleBackground()) {
if (liftOnScrollColor != null) {
startLiftOnScrollColorAnimation(
lifted ? 0 : 255, lifted ? 255 : 0);
} else {
// Only start the liftOnScrollColor based animation because the elevation based
// animation will happen via the lifted drawable state change and state list animator.
startLiftOnScrollColorAnimation(lifted ? 0 : 255, lifted ? 255 : 0);
} else if (liftOnScroll) {
startLiftOnScrollColorAnimation(
lifted ? 0 : appBarElevation, lifted ? appBarElevation : 0);
}
Expand Down

0 comments on commit 43242f2

Please sign in to comment.