Skip to content

Commit

Permalink
[Start] Fix the closing tab animation in grid tab switcher surface.
Browse files Browse the repository at this point in the history
When we switch to grid tab switcher surface from start surface,
#prepareTabSwitcherView won't be called since it's not a layout change.
So |mOriginalAnimator| is not initialized and closing tab animation is
not shown.
This CL adds a null check for |mOriginalAnimator| to fix this problem.

Before:
https://drive.google.com/file/d/1am7UfBY_7VY8BCuBStyI9sCxhfnvoKUA/view?usp=sharing&resourcekey=0-DuOCztQLuQPGjZw3n9aqSw
After:
https://drive.google.com/file/d/1PbiNL6OfBTxEBFhk246qeT1kglDpwzk_/view?usp=sharing&resourcekey=0-vcPbhEzFheDHy-JaAysfaQ

(cherry picked from commit deeb007)

Bug: 1200882
Change-Id: I6372b9dceeaaa5ec78cfef70cee0d972b13b5d2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3664819
Reviewed-by: Mei Liang <meiliang@chromium.org>
Commit-Queue: Hao Dong <spdonghao@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1007646}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3669600
Commit-Queue: Krishna Govind <govind@chromium.org>
Reviewed-by: Krishna Govind <govind@chromium.org>
Owners-Override: Krishna Govind <govind@chromium.org>
Cr-Commit-Position: refs/branch-heads/5060@{#289}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
spdonghao authored and Chromium LUCI CQ committed May 27, 2022
1 parent 0954174 commit 769dd3a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public void onAnimationEnd(Animator animation) {
private ImageView mShadowImageView;
private int mShadowTopOffset;
private TabListOnScrollListener mScrollListener;
// It is null when gts-tab animation is disabled or switching from Start surface to GTS.
@Nullable
private RecyclerView.ItemAnimator mOriginalAnimator;

/**
Expand Down Expand Up @@ -203,7 +205,12 @@ public void onAnimationEnd(Animator animation) {
mFadeInAnimator = null;
mListener.finishedShowing();
// Restore the original value.
setItemAnimator(mOriginalAnimator);
// TODO(crbug.com/1315676): Remove the null check after decoupling Start surface
// layout and grid tab switcher layout.
if (mOriginalAnimator != null) {
setItemAnimator(mOriginalAnimator);
mOriginalAnimator = null;
}
setShadowVisibility(computeVerticalScrollOffset() > 0);
if (mDynamicView != null) {
mDynamicView.dropCachedBitmap();
Expand Down

0 comments on commit 769dd3a

Please sign in to comment.