Merge "Avoid dividing 0 by 0 in StackScrollAlgorithm." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2ba952ac0c
@@ -884,6 +884,9 @@ public class StackScrollAlgorithm {
|
|||||||
childViewState.zTranslation = baseZ;
|
childViewState.zTranslation = baseZ;
|
||||||
} else {
|
} else {
|
||||||
float factor = (notificationEnd - shelfStart) / shelfHeight;
|
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);
|
factor = Math.min(factor, 1.0f);
|
||||||
childViewState.zTranslation = baseZ + factor * zDistanceBetweenElements;
|
childViewState.zTranslation = baseZ + factor * zDistanceBetweenElements;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user