Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 700259f0afe267dfe78b93db932a3cfd827a119d
Author: Sherry Hu <shuanghu@google.com>
Date: Mon May 10 14:23:09 2021
Add transition motion between fold and unfold.
Bug: 186211031
Test: manual
Change-Id: Id60f07311eca2d94ef91dc28ae45823a475160b4
M slidingpanelayout/slidingpanelayout/build.gradle
M slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
M slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
https://android-review.googlesource.com/1702066
Branch: androidx-main
commit 700259f0afe267dfe78b93db932a3cfd827a119d
Author: Sherry Hu <shuanghu@google.com>
Date: Mon May 10 14:23:09 2021
Add transition motion between fold and unfold.
Bug: 186211031
Test: manual
Change-Id: Id60f07311eca2d94ef91dc28ae45823a475160b4
M slidingpanelayout/slidingpanelayout/build.gradle
M slidingpanelayout/slidingpanelayout/src/androidTest/java/androidx/slidingpanelayout/widget/FoldTest.kt
M slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
Description
Run the snippet below, click on a couple of items and scroll
Observed behavior: When items (that reused the LayoutNode and concequently the modifier node for animateContentSize) are brought into the viewport for the first time, they animate to their initial size.
Expected bahvior: No animation for initial size
```
@Preview
@Composable
fun LazyColumnWithAnimatedContentSize() {
LazyColumn {
repeat(30) {
item { MyText() }
}
}
}
@Composable
private fun MyText() {
val shortText = "Click me"
val longText = "Very long text\nthat spans across\nmultiple lines"
var short by remember { mutableStateOf(true) }
Box(
modifier = Modifier
.background(
Color.Blue,
RoundedCornerShape(15.dp)
)
.clickable { short = !short }
.padding(20.dp)
.wrapContentSize()
.animateContentSize { startSize, endSize -> println("$startSize -> $endSize") }
) {
Text(
if (short) {
shortText
} else {
longText
},
style = LocalTextStyle.current.copy(color = Color.White)
)
}
}
```