Don't crash if getWidth is 0

Bug: 79203256
Change-Id: I3f91adbda40931e882c4f768794a0d803730805e
This commit is contained in:
Tony Wickham 2018-05-03 12:50:05 -07:00
parent f325b19de3
commit 181968b87b
1 changed files with 6 additions and 1 deletions

View File

@ -780,7 +780,12 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
int scrollForSecondTask = mRecentsView.getChildCount() > 1
? mRecentsView.getScrollForPage(1) : scrollForFirstTask;
int offsetFromFirstTask = scrollForFirstTask - scrollForSecondTask;
float interpolation = offsetFromFirstTask / (mRecentsView.getWidth() / 2);
final float interpolation;
if (mRecentsView.getWidth() == 0) {
interpolation = scrollForSecondTask == scrollForFirstTask ? 0 : 1;
} else {
interpolation = (float) offsetFromFirstTask / (mRecentsView.getWidth() / 2);
}
mClipAnimationHelper.offsetTarget(
firstTask.getCurveScaleForInterpolation(interpolation), offsetFromFirstTask,
mActivityControlHelper.getTranslationYForQuickScrub(mActivity));