Commit 737ecff5 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Web Payment][Android] No animation of null bottom sheet.

Before this patch, skip-the-sheet flow on Android would attempt to
animate out the browser sheet when showing transaction errors, even
though the sheet was not shown.

This patch checks for presence of the sheet before animating it.

After this patch, the browser checks for existence of the sheet before
animating it out.

Bug: 952283
Change-Id: I7e7179edce53f10d8d156159192a31e2cc2d5795
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1818223
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699374}
parent a3a0eeb5
......@@ -31,6 +31,9 @@ import org.chromium.chrome.browser.ui.widget.animation.AnimatorProperties;
import org.chromium.chrome.browser.ui.widget.animation.Interpolators;
import org.chromium.chrome.browser.util.ColorUtils;
import java.util.ArrayList;
import java.util.Collection;
/**
* A fullscreen semitransparent dialog used for dimming Chrome when overlaying a bottom sheet
* dialog/CCT or an alert dialog on top of it. FLAG_DIM_BEHIND is not being used because it causes
......@@ -196,25 +199,31 @@ import org.chromium.chrome.browser.util.ColorUtils;
public DisappearingAnimator(boolean removeDialog) {
mIsDialogClosing = removeDialog;
View child = mFullContainer.getChildAt(0);
assert child != null;
Collection<Animator> animators = new ArrayList<>();
Animator sheetFader = ObjectAnimator.ofFloat(child, View.ALPHA, child.getAlpha(), 0f);
Animator sheetTranslator =
ObjectAnimator.ofFloat(child, View.TRANSLATION_Y, 0f, mAnimatorTranslation);
View child = mFullContainer.getChildAt(0);
if (child != null) {
// Sheet fader.
animators.add(ObjectAnimator.ofFloat(child, View.ALPHA, child.getAlpha(), 0f));
// Sheet translator.
animators.add(ObjectAnimator.ofFloat(
child, View.TRANSLATION_Y, 0f, mAnimatorTranslation));
}
AnimatorSet current = new AnimatorSet();
current.setDuration(DIALOG_EXIT_ANIMATION_MS);
current.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN_INTERPOLATOR);
if (mIsDialogClosing) {
Animator scrimFader = ObjectAnimator.ofInt(mFullContainer.getBackground(),
AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 127, 0);
current.playTogether(sheetFader, sheetTranslator, scrimFader);
} else {
current.playTogether(sheetFader, sheetTranslator);
// Scrim fader.
animators.add(ObjectAnimator.ofInt(mFullContainer.getBackground(),
AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 127, 0));
}
if (animators.isEmpty()) return;
mIsAnimatingDisappearance = true;
AnimatorSet current = new AnimatorSet();
current.setDuration(DIALOG_EXIT_ANIMATION_MS);
current.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN_INTERPOLATOR);
current.playTogether(animators);
current.addListener(this);
current.start();
}
......
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