Commit 0671758b authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Fix issue with scrim becoming invisible during animation

This patch fixes an issue with the scrim that would cause it to become
invisible if re-shown while hiding. The onAnimationEnd event would
remove the scrim from the tree when it was still needed. This is
resolved by making the animator listener one that is cancel-aware. The
scrim is not removed from the tree if the animation is canceled (if
the animation should end early, the #end() method should be called
instead).

Bug: 865109
Change-Id: I5a83bc486a2798ddca8dca4fefc6a0a340fa1613
Reviewed-on: https://chromium-review.googlesource.com/1156482Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579431}
parent 75a6accb
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.widget;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.support.annotation.NonNull;
......@@ -17,6 +16,7 @@ import android.view.ViewGroup.MarginLayoutParams;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.util.MathUtils;
import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener;
import org.chromium.ui.UiUtils;
import org.chromium.ui.interpolators.BakedBezierInterpolator;
......@@ -260,9 +260,9 @@ public class ScrimView extends View implements View.OnClickListener {
mOverlayFadeOutAnimator = ObjectAnimator.ofFloat(this, ALPHA, 0f);
mOverlayFadeOutAnimator.setDuration(FADE_DURATION_MS);
mOverlayFadeOutAnimator.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);
mOverlayFadeOutAnimator.addListener(new AnimatorListenerAdapter() {
mOverlayFadeOutAnimator.addListener(new CancelAwareAnimatorListener() {
@Override
public void onAnimationEnd(Animator animation) {
public void onEnd(Animator animation) {
setVisibility(View.GONE);
if (mActiveParams != null && mActiveParams.observer != null) {
mActiveParams.observer.onScrimVisibilityChanged(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment