Fixed
Status Update
Comments
is...@google.com <is...@google.com>
[Deleted User] <[Deleted User]> #2
The behaviour seems to work with "wrapcontent' but not 'preferredWrapContent'
os...@google.com <os...@google.com>
ho...@google.com <ho...@google.com> #3
Why did you set
height = Dimension.preferredWrapContent
not
height = Dimension.wrapContent
?
height = Dimension.preferredWrapContent
not
height = Dimension.wrapContent
?
ti...@gmail.com <ti...@gmail.com> #4
Not OP, but I am having the same issue and the answer is because wrap_content would be wrong too? We sometimes need preferredWrapContent and it doesn't work on changes.
[Deleted User] <[Deleted User]> #5
I need preferredWrapContent for a specific case on an application. I want the content to never be outside my constraints, that's all.
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit 50fdccbb6bd61862f871944da801af71fee9870f
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Tue Nov 22 12:32:21 2022
Fix not being able to remeasure when the content changes
This makes it so that the MeasurePolicy is at least tied to content
composition. So that ConstraintLayout/MotionLayout are always able to
measure the content with their own logic.
Relnote: N/A
Bug: 243861990
Fixes: 219091179
Test: ConstraintLayoutTest, MultiMeasureCompositionTest
Change-Id: Ibfe8a2aeffba85aa6374d763729887aa1f308b35
M constraintlayout/constraintlayout-compose/api/public_plus_experimental_current.txt
M constraintlayout/constraintlayout-compose/api/restricted_current.txt
M constraintlayout/constraintlayout-compose/integration-tests/constraintlayout-compose-demos/src/main/java/androidx/constraintlayout/compose/demos/CustomKeyAttributesDemo.kt
M constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTest.kt
A constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MultiMeasureCompositionTest.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionDragHandler.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionMeasurer.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.java
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/Transition.kt
https://android-review.googlesource.com/2328906
Branch: androidx-main
commit 50fdccbb6bd61862f871944da801af71fee9870f
Author: Oscar Adame Vázquez <oscarad@google.com>
Date: Tue Nov 22 12:32:21 2022
Fix not being able to remeasure when the content changes
This makes it so that the MeasurePolicy is at least tied to content
composition. So that ConstraintLayout/MotionLayout are always able to
measure the content with their own logic.
Relnote: N/A
Bug: 243861990
Fixes: 219091179
Test: ConstraintLayoutTest, MultiMeasureCompositionTest
Change-Id: Ibfe8a2aeffba85aa6374d763729887aa1f308b35
M constraintlayout/constraintlayout-compose/api/public_plus_experimental_current.txt
M constraintlayout/constraintlayout-compose/api/restricted_current.txt
M constraintlayout/constraintlayout-compose/integration-tests/constraintlayout-compose-demos/src/main/java/androidx/constraintlayout/compose/demos/CustomKeyAttributesDemo.kt
M constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/ConstraintLayoutTest.kt
A constraintlayout/constraintlayout-compose/src/androidAndroidTest/kotlin/androidx/constraintlayout/compose/MultiMeasureCompositionTest.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionDragHandler.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionMeasurer.kt
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.java
M constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/Transition.kt
ri...@ffw.com <ri...@ffw.com> #7
Which version is this fix in?
os...@google.com <os...@google.com> #8
Will be in 1.1.0-alpha06. Which is set to release next week.
pr...@google.com <pr...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.constraintlayout:constraintlayout-compose:1.1.0-alpha06
Description
I'm using a Composable which take a content @Composable in parameter, and it seems that with the final version of ConstraintLayout, there is no update.
Here is the code
@Composable
Example(
modifier : Modifier = Modifier,
content : @Composable () -> Unit
) {
ConstraintLayout(modifier = modifier
.fillMaxSize()
.background(color = Color.Blue)
) {
val (title, someContent) = createRefs()
Text(text = "a text", modifier = Modifier.constrainAs(title) {
top.linkTo(parent.top)
height = Dimension.wrapContent
width = Dimension.wrapContent
})
Box(modifier = Modifier
.constrainAs(someContent) {
width = Dimension.fillToConstraints
linkTo(start = parent.start, end = parent.end)
linkTo(top = parent.top, bottom = parent.bottom, bias = 1.0f)
height = Dimension.preferredWrapContent
}
.background(color = Color.Yellow)) {
content()
}
}
}
The Box height is initialized with the fist element received by the composable and does not change anymore.
For example, I send to this composable a Column with [Button + result of a Webservice]. The button is displayed at startup, and then after some times I received the result of the API, it does not recompose correctly, the size of the Box stays wrapcontent with the button only!
Moreover, it seems that the behaviour in a compose MotionLayout is the same (no update)