Status Update
Comments
ma...@google.com <ma...@google.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),
)
}
ki...@gmail.com <ki...@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> #4
#2, yeah, that's the same issue.
ki...@gmail.com <ki...@gmail.com> #5
Thanks @jo...@google.com for fixing this! Do you know when the fix would be available for g3 apps?
ap...@google.com <ap...@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.
ap...@google.com <ap...@google.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
am...@gmail.com <am...@gmail.com> #8
al...@gmail.com <al...@gmail.com> #9
Yes, it is available in the latest compose released yesterday
ma...@google.com <ma...@google.com> #10
Will there ever be support for Android 11 and below?
Stretch effect overscroll will be supported only for android 12 and above. For versions prior to that, the original glow edge overscroll will be shown.
This is done by design, so that overscroll in every app will feel the same, leaving users with the feel of consistency.
I hope that makes sense.
ku...@gmail.com <ku...@gmail.com> #11
ma...@google.com <ma...@google.com> #12
This looks broken indeed. I believe this should not happen if you are using latest snapshot where we properly support stretch effect. Could you share more information about this sample's setup? Compose version, code with snippet (is it LazyColumn, Modifier.verticalScroll or your own Modifier.scrollable) and any other relevant info.
Thanks.
ku...@gmail.com <ku...@gmail.com> #13
I used LazyColumn in compose_version = '1.1.0-alpha03'
. I just created a brand new project to test this, still the same issue. I am attaching android version,build number... if that helps.
//code snippet
@Composable
fun ScreenMain() {
LazyColumn(
modifier = Modifier.fillMaxSize(),
content = {
items(30) {
RowItem(number = it)
}
})
}
@Composable
fun RowItem(number: Int) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
.padding(all = 8.dp)
.border(width = 1.dp, color = Color.Red),
contentAlignment = Alignment.Center,
) {
Text(text = "Row $number", color = Color.Black)
}
}
ma...@google.com <ma...@google.com> #14
Thanks for additional info.
I tried this example in the emulator, pixel 3 and some various Samsungs, and I cannot reproduce the issue for some reason.
There's a version check that prohibits any kind of overscroll for S devices on 1.1.0-alpha03.
Could you please try a real phone with android S if you have some? Or a fresh emulator image?
Alternatively, you can turn off overscroll for now and wait for alpha04 where stretch overscroll for S devices will be fully supported.
ku...@gmail.com <ku...@gmail.com> #15
Thanks for the reply. I reinstalled Android S Images and then created a new virtual device. Issue seems to be resolved now. Probably issue was with the S preview.
ma...@google.com <ma...@google.com> #16
Oh, that makes sense as well, as some S previews had incomplete support for stretch in the RenderNode, so it might have been broken there.
I'm glad that everything is working well for you now!
al...@gmail.com <al...@gmail.com> #17
Is the default material color correct for both light mode and dark mode? I see 0xff666666
hardcoded here:
But IIRC this color is themed using android:colorEdgeEffect
, for example here:
Might need to update MaterialTheme.kt
and the
ma...@google.com <ma...@google.com> #18
Yup, you are right.
The default color is design system agnostic. Since we're waiting for API feedback - we cannot wire up foundation glow api with material just yet. It will be done as soon as we will graduate OverScrollConfiguration from experimental.
you can do it manually for now in your app.
Description
On Android, over-scroll ripples show up by default on scrollable containers such as
ScrollView
andRecyclerView
. Internally they are implemented usingEdgeEffect
and their colors are typically customized in the application theme usingandroid:colorEdgeEffect
.I noticed this behavior does not seem to exist in Compose. It would be great if it could be supported to achieve parity with the traditional view system!
(I'm filing this under the
material
tracker because the default edge effect renders a ripple animation on Android, but I realize the scope of this likely falls under thefoundation
category as well).