Skip to content
Snippets Groups Projects
Commit 2597bf42 authored by Priyanka Advani's avatar Priyanka Advani Committed by Gerrit Code Review
Browse files

Merge changes from topic...

Merge changes from topic "revert-3085486-cherrypicker-L33500030003548614:N45100030056225643-AHBLMNZHOI" into main

* changes:
  Revert "Fix LargeTopAppBarNestedScrollConnectionTest for ag/26995613"
  Revert "[STL] Address API council feedback on ApproachLayoutModi..."
parents dde07755 b20ec5d2
No related branches found
No related tags found
No related merge requests found
......@@ -32,11 +32,10 @@ import androidx.compose.ui.geometry.isUnspecified
import androidx.compose.ui.geometry.lerp
import androidx.compose.ui.graphics.drawscope.ContentDrawScope
import androidx.compose.ui.graphics.drawscope.scale
import androidx.compose.ui.layout.ApproachMeasureScope
import androidx.compose.ui.layout.LookaheadScope
import androidx.compose.ui.layout.IntermediateMeasureScope
import androidx.compose.ui.layout.Measurable
import androidx.compose.ui.layout.Placeable
import androidx.compose.ui.layout.approachLayout
import androidx.compose.ui.layout.intermediateLayout
import androidx.compose.ui.node.DrawModifierNode
import androidx.compose.ui.node.ModifierNodeElement
import androidx.compose.ui.platform.testTag
......@@ -154,9 +153,7 @@ internal fun Modifier.element(
return this.then(ElementModifier(layoutImpl, scene, element, sceneValues))
// TODO(b/311132415): Move this into ElementNode once we can create a delegate
// IntermediateLayoutModifierNode.
.approachLayout(
isMeasurementApproachInProgress = { layoutImpl.state.isTransitioning() },
) { measurable, constraints ->
.intermediateLayout { measurable, constraints ->
val placeable =
measure(layoutImpl, scene, element, sceneValues, measurable, constraints)
layout(placeable.width, placeable.height) {
......@@ -431,7 +428,7 @@ private fun elementAlpha(
}
@OptIn(ExperimentalComposeUiApi::class)
private fun ApproachMeasureScope.measure(
private fun IntermediateMeasureScope.measure(
layoutImpl: SceneTransitionLayoutImpl,
scene: Scene,
element: Element,
......@@ -508,7 +505,7 @@ private fun getDrawScale(
}
@OptIn(ExperimentalComposeUiApi::class)
private fun ApproachMeasureScope.place(
private fun IntermediateMeasureScope.place(
layoutImpl: SceneTransitionLayoutImpl,
scene: Scene,
element: Element,
......@@ -516,8 +513,6 @@ private fun ApproachMeasureScope.place(
placeable: Placeable,
placementScope: Placeable.PlacementScope,
) {
this as LookaheadScope
with(placementScope) {
// Update the offset (relative to the SceneTransitionLayout) this element has in this scene
// when idle.
......
......@@ -30,7 +30,7 @@ import androidx.compose.runtime.snapshots.SnapshotStateMap
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.layout.approachLayout
import androidx.compose.ui.layout.intermediateLayout
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.zIndex
......@@ -60,9 +60,7 @@ internal class Scene(
Box(
modifier
.zIndex(zIndex)
.approachLayout(
isMeasurementApproachInProgress = { scope.layoutState.isTransitioning() }
) { measurable, constraints ->
.intermediateLayout { measurable, constraints ->
targetSize = lookaheadSize
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) { placeable.place(0, 0) }
......
......@@ -29,7 +29,7 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.layout.LookaheadScope
import androidx.compose.ui.layout.approachLayout
import androidx.compose.ui.layout.intermediateLayout
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.util.fastForEach
......@@ -150,9 +150,7 @@ internal class SceneTransitionLayoutImpl(
.swipeToScene(horizontalGestureHandler)
.swipeToScene(verticalGestureHandler)
// Animate the size of this layout.
.approachLayout(
isMeasurementApproachInProgress = { state.isTransitioning() },
) { measurable, constraints ->
.intermediateLayout { measurable, constraints ->
// Measure content normally.
val placeable = measurable.measure(constraints)
......
......@@ -35,7 +35,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.approachLayout
import androidx.compose.ui.layout.intermediateLayout
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
......@@ -67,9 +67,7 @@ class ElementTest {
modifier
.offset(offset)
.element(key)
.approachLayout(
isMeasurementApproachInProgress = { layoutState.isTransitioning() },
) { measurable, constraints ->
.intermediateLayout { measurable, constraints ->
onLayout()
val placement = measurable.measure(constraints)
layout(placement.width, placement.height) {
......@@ -438,7 +436,7 @@ class ElementTest {
// page should be composed.
HorizontalPager(
pagerState,
beyondViewportPageCount = 0,
outOfBoundsPageCount = 0,
) { page ->
when (page) {
0 -> Box(Modifier.element(TestElements.Foo).fillMaxSize())
......
......@@ -201,11 +201,11 @@ class LargeTopAppBarNestedScrollConnectionTest(testCase: TestCase) {
companion object {
@Parameterized.Parameters(name = "{0}")
@JvmStatic
fun data(): List<TestCase> {
return listOf(
TestCase(NestedScrollSource.UserInput),
TestCase(NestedScrollSource.SideEffect),
fun data(): List<TestCase> =
listOf(
TestCase(NestedScrollSource.Drag),
TestCase(NestedScrollSource.Fling),
TestCase(NestedScrollSource.Wheel),
)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment