Merge "Ensure that ghosted view is attached when calculating its matrix." into sc-v2-dev am: ad71aa409d am: fce72425a0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16048150

Change-Id: I06fbb1e051cb7330c09df7c5de1646d2a5f89a75
This commit is contained in:
Jordan Demeulenaere
2021-10-19 10:36:36 +00:00
committed by Automerger Merge Worker

View File

@@ -209,8 +209,13 @@ open class GhostedViewLaunchAnimatorController(
val heightRatio = state.height.toFloat() / ghostedViewState.height
val scale = min(widthRatio, heightRatio)
if (ghostedView.parent is ViewGroup) {
// Recalculate the matrix in case the ghosted view moved. We ensure that the ghosted
// view is still attached to a ViewGroup, otherwise calculateMatrix will throw.
GhostView.calculateMatrix(ghostedView, launchContainer, ghostViewMatrix)
}
launchContainer.getLocationOnScreen(launchContainerLocation)
GhostView.calculateMatrix(ghostedView, launchContainer, ghostViewMatrix)
ghostViewMatrix.postScale(
scale, scale,
ghostedViewState.centerX - launchContainerLocation[0],