Merge "Ensure final height of UMO transition is the hostView's height" into tm-qpr-dev

This commit is contained in:
Hawkwood Glazier
2022-11-29 15:34:12 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 12 deletions

View File

@@ -1053,18 +1053,9 @@ constructor(
rootOverlay!!.add(mediaFrame) rootOverlay!!.add(mediaFrame)
} else { } else {
val targetHost = getHost(newLocation)!!.hostView val targetHost = getHost(newLocation)!!.hostView
// When adding back to the host, let's make sure to reset the bounds. // This will either do a full layout pass and remeasure, or it will bypass
// Usually adding the view will trigger a layout that does this automatically, // that and directly set the mediaFrame's bounds within the premeasured host.
// but we sometimes suppress this.
targetHost.addView(mediaFrame) targetHost.addView(mediaFrame)
val left = targetHost.paddingLeft
val top = targetHost.paddingTop
mediaFrame.setLeftTopRightBottom(
left,
top,
left + currentBounds.width(),
top + currentBounds.height()
)
if (mediaFrame.childCount > 0) { if (mediaFrame.childCount > 0) {
val child = mediaFrame.getChildAt(0) val child = mediaFrame.getChildAt(0)

View File

@@ -420,7 +420,9 @@ constructor(
*/ */
fun getMeasurementsForState(hostState: MediaHostState): MeasurementOutput? = fun getMeasurementsForState(hostState: MediaHostState): MeasurementOutput? =
traceSection("MediaViewController#getMeasurementsForState") { traceSection("MediaViewController#getMeasurementsForState") {
val viewState = obtainViewState(hostState) ?: return null // measurements should never factor in the squish fraction
val viewState =
obtainViewState(hostState.copy().also { it.squishFraction = 1.0f }) ?: return null
measurement.measuredWidth = viewState.width measurement.measuredWidth = viewState.width
measurement.measuredHeight = viewState.height measurement.measuredHeight = viewState.height
return measurement return measurement