Merge "Avoid dividing 0 by 0 in StackScrollAlgorithm." into tm-qpr-dev

This commit is contained in:
Ioana Alexandru
2022-10-10 08:25:09 +00:00
committed by Android (Google) Code Review

View File

@@ -884,6 +884,9 @@ public class StackScrollAlgorithm {
childViewState.zTranslation = baseZ;
} else {
float factor = (notificationEnd - shelfStart) / shelfHeight;
if (Float.isNaN(factor)) { // Avoid problems when the above is 0/0.
factor = 1.0f;
}
factor = Math.min(factor, 1.0f);
childViewState.zTranslation = baseZ + factor * zDistanceBetweenElements;
}