File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
lib/java/com/google/android/material/search Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -458,11 +458,25 @@ private void addBackButtonProgressAnimatorIfNeeded(AnimatorSet animatorSet) {
458458 if (searchView .isAnimatedNavigationIcon ()) {
459459 addDrawerArrowDrawableAnimatorIfNeeded (animatorSet , drawable );
460460 addFadeThroughDrawableAnimatorIfNeeded (animatorSet , drawable );
461+ addBackButtonAnimatorIfNeeded (animatorSet , backButton );
461462 } else {
462463 setFullDrawableProgressIfNeeded (drawable );
463464 }
464465 }
465466
467+ private void addBackButtonAnimatorIfNeeded (AnimatorSet animatorSet , ImageButton backButton ) {
468+ // If there's no navigation icon on the search bar, we should set the alpha for the button
469+ // itself instead of the drawables since the button background has a ripple.
470+ if (searchBar == null || searchBar .getNavigationIcon () != null ) {
471+ return ;
472+ }
473+
474+ ValueAnimator animator = ValueAnimator .ofFloat (0 , 1 );
475+ animator .addUpdateListener (
476+ animation -> backButton .setAlpha ((Float ) animation .getAnimatedValue ()));
477+ animatorSet .playTogether (animator );
478+ }
479+
466480 private void addDrawerArrowDrawableAnimatorIfNeeded (AnimatorSet animatorSet , Drawable drawable ) {
467481 if (drawable instanceof DrawerArrowDrawable ) {
468482 DrawerArrowDrawable drawerArrowDrawable = (DrawerArrowDrawable ) drawable ;
You can’t perform that action at this time.
0 commit comments