Fix NPE when closing folder. am: a28e0f474a

Change-Id: I9361391fab78e10e727635c7b27aca97b5698038
This commit is contained in:
Jon Miranda 2020-04-17 23:15:20 +00:00 committed by Automerger Merge Worker
commit ae3efb2232
1 changed files with 10 additions and 0 deletions

View File

@ -164,6 +164,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
@Thunk final ArrayList<View> mItemsInReadingOrder = new ArrayList<View>();
private AnimatorSet mCurrentAnimator;
private boolean mIsAnimatingClosed = false;
protected final Launcher mLauncher;
protected DragController mDragController;
@ -729,15 +730,24 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
}
private void animateClosed() {
if (mIsAnimatingClosed) {
return;
}
if (mCurrentAnimator != null && mCurrentAnimator.isRunning()) {
mCurrentAnimator.cancel();
}
AnimatorSet a = new FolderAnimationManager(this, false /* isOpening */).getAnimator();
a.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mIsAnimatingClosed = true;
}
@Override
public void onAnimationEnd(Animator animation) {
closeComplete(true);
announceAccessibilityChanges();
mIsAnimatingClosed = false;
}
});
startAnimation(a);