Status Update
Comments
ma...@gmail.com <ma...@gmail.com> #2
Hi,
I also see my text cut off when I set maxLines = 2
. Is it the same issue?
Box(
modifier =
Modifier.size(
width = 108dp,
height = 34dp,
),
contentAlignment = Alignment.Center,
) {
BasicText(
text = "text text text",
maxLines = 2,
autoSize = AutoSize.StepBased(minFontSize = 1.sp, maxFontSize = 13.sp, stepSize = 0.2.sp),
)
}
ma...@gmail.com <ma...@gmail.com> #3
Project: platform/frameworks/support
Branch: androidx-main
Author: Jossi Wolf <
Link:
Fix TextAutoSize bug with maxLines = 1
Expand for full commit details
Fix TextAutoSize bug with maxLines = 1
We were overcaching the paragraphIntrinsics in MultiParagraphLayoutCache when mutating the style. For `AutoSizeStepBased` instances with biased windows (more values smaller/bigger than the optimal), this could result in performing layout with outdated intrinsics, and thus an outdated style and font size, without surfacing this in the TextLayoutResult.
Test: New MultiParagraphLayoutCacheTests and manual testing
Relnote: Fixed a bug in BasicText with TextAutoSize and maxLines set to 1.
Fixes: 376834366
Change-Id: Ic0450c763c5d764492995b44ee1fe570246a9689
Files:
- M
compose/foundation/foundation/src/androidInstrumentedTest/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCacheTest.kt
- M
compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/MultiParagraphLayoutCache.kt
Hash: e1b712d78cc60384ed67a56c006148291ba146a6
Date: Tue Jan 07 18:52:26 2025
ma...@google.com <ma...@google.com>
ke...@google.com <ke...@google.com>
ki...@gmail.com <ki...@gmail.com> #4
#2, yeah, that's the same issue.
ki...@gmail.com <ki...@gmail.com> #5
Thanks @jossiwolf@google.com for fixing this! Do you know when the fix would be available for g3 apps?
co...@google.com <co...@google.com>
ke...@google.com <ke...@google.com> #6
Moving the internal discussion offline. The bug is fixed and the fix available in snapshot builds. We will comment on this issue when the bug fix is included in a release.
ki...@gmail.com <ki...@gmail.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-beta01
androidx.compose.foundation:foundation-android:1.8.0-beta01
androidx.compose.foundation:foundation-jvmstubs:1.8.0-beta01
androidx.compose.foundation:foundation-linuxx64stubs:1.8.0-beta01
ev...@tatarka.me <ev...@tatarka.me> #8
Ran into the same issue, the onValuChangeFinished lambda is being passed as a remember key so recreates the state if that lambda reference changes (as seen in
val context = LocalContext.current
var sliderPosition by remember { mutableStateOf(0f) }
val onValueChangeFinished: () -> Unit = remember {
{ Toast.makeText(context, sliderPosition.toString(), Toast.LENGTH_SHORT).show() }
}
Text(text = sliderPosition.toString())
Slider(
value = sliderPosition,
onValueChange = { sliderPosition = it },
onValueChangeFinished = onValueChangeFinished
)
ke...@google.com <ke...@google.com>
co...@google.com <co...@google.com> #9
Feb 19 is a U.S. holiday, there are 12+ impacted so far, Kevin, could you please take a look on tues once you are back at work? ty!
ke...@google.com <ke...@google.com> #10
Yup, taking a look. Thanks Connie!
ke...@google.com <ke...@google.com>
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit dde2e9109164e8cf8e8bad4a28954d35cad19d76
Author: Kevin Truong <kevinctruong@google.com>
Date: Fri Jan 26 13:24:33 2024
[Slider] Fix for using Toast or Snackbar in onValueChangeFinished
Remove onValueChangeFinished as a key to remember for Slider and RangeSlider.
Set the value of state.onValueChangeFinished to onValueChangeFinished in stateless APIs, so any new version of onValueChangeFinished is still
propagated to the state. Removing @Stable from the states since state.onValueChangeFinished is now a var.
Bug: 322269951
Test: Adding test for Slider and RangeSlider that triggers a snackbar in onValueChangeFinished. Testing that both Slider and RangeSlider drag to the correct position without the snackbar causing ths slider to stop drag.
Relnote: Removing @Stable from the states of Slider since we're changing state.onValueCHangeFinished to a var.
Change-Id: Ied34a92fed040ceeb5d676d6f75767ee33762cfb
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/SliderTest.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit 74979312fabd3061fcb2cf34714c3afc1ffe2088
Author: Kevin Truong <kevinctruong@google.com>
Date: Tue Feb 27 12:38:49 2024
[Slider] Making States Stable
Making the states stable again, making State.onValueChangeFinished a val again, and wrapping onValueChangeFinished with a rememberUpdatedState.
Bug: 322269951
Test: N/A
Relnote: Making the states stable again. Making State.onValueChangeFinished a val again. Wrapping onValueChangeFinished in a rememberUpdatedState.
Change-Id: I82ab29f469b01077eb17a70204f43b7a154abc1d
M compose/material3/material3/api/current.txt
M compose/material3/material3/api/restricted_current.txt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
na...@google.com <na...@google.com> #13
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3:1.2.1
androidx.compose.material3:material3-android:1.2.1
androidx.compose.material3:material3-desktop:1.2.1
androidx.compose.material3:material3:1.3.0-alpha02
androidx.compose.material3:material3-android:1.3.0-alpha02
androidx.compose.material3:material3-desktop:1.3.0-alpha02
Description
Jetpack Compose version: compose-ui = "1.6.0", compose-foundation = "1.6.0", material3-android = "1.2.0-rc01"
Jetpack Compose component used: Slider
Android Studio Build: Giraffe | 2022.3.1 Patch 3
Kotlin version: 1.8.10
Code Sample to Reproduce:
Now if you run the app and try to slide the slider, the sliding gets interrupted, and onValueChangeFinished is called continuously.
This problem occurs also in version "1.2.0-beta01" and above.