[automerger] Fix crash caused by removing update listener in update listener. am: 012d39a0e9 am: cd1727c069

Change-Id: Icd7aab53e7bd7cb65132f10ff752165ff57e2b46
This commit is contained in:
Android Build Merger (Role) 2018-05-25 17:42:53 +00:00
commit 76c59da5c0
1 changed files with 5 additions and 2 deletions

View File

@ -466,9 +466,12 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
*/
public void addSpringFromFlingUpdateListener(ValueAnimator animator, float velocity) {
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
boolean shouldSpring = true;
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (valueAnimator.getAnimatedFraction() >= FLING_ANIMATION_THRESHOLD) {
if (shouldSpring
&& valueAnimator.getAnimatedFraction() >= FLING_ANIMATION_THRESHOLD) {
int searchViewId = getSearchView().getId();
addSpringView(searchViewId);
@ -481,7 +484,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
}
});
animator.removeUpdateListener(this);
shouldSpring = false;
}
}
});