Status Update
Comments
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
si...@google.com <si...@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),
)
}
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
si...@google.com <si...@google.com>
si...@google.com <si...@google.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
si...@google.com <si...@google.com>
si...@google.com <si...@google.com> #4
#2, yeah, that's the same issue.
si...@google.com <si...@google.com> #5
Thanks @jo...@google.com for fixing this! Do you know when the fix would be available for g3 apps?
si...@google.com <si...@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.
al...@gmail.com <al...@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
lp...@google.com <lp...@google.com> #8
I agree with
Siyamed, if you / your team does not have time to look at this, feel free to assign to me - happy to take this over. As well as allowing changing the color, MaterialTheme
should also be configured to set a color from the theme by default so that it is correct out of the box for typicaly use cases.
si...@google.com <si...@google.com> #10
Thanks Louis.
Please keep in mind there are two main entry points: Text selection and TextField selection. as a note: In TextField it is possible that existing cursorColor defines those colors (or one of them)
si...@google.com <si...@google.com> #11
it would be best to control selection as a whole for both of them I believe, but let's discuss it. Looks like material.TextField uses errorColor and activeColor as the cursor color. let's make sure we take that into account while designing the theming (they seem to be related)
si...@google.com <si...@google.com> #12
open questions, assumptions that need verification:
- is cursorColor and selection color the same
- cursorColor is errorColor and activeColor in material.TextField, is there any relation
- Text and TextField should use a single selection color for consistency
- selection color is always the same for selection handle and selection background
- cursor color determines insertion (cursor) handle color as well (we do not have cursor handle yet)
- what the default color should be for light and dark mode
- shape of the cursor handle is not urgent, and possibly something we specifically don't want customization for the phone end user experience (similar to cursor animation)
- can there be a default color in foundation? choosing the text color, bg color etc too tricky. Using the exact text color wouldn't work since it would make text invisible.
ap...@google.com <ap...@google.com> #13
Branch: androidx-master-dev
commit 93195d42d1f079136053e33ccec6e7d5ac839dfe
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Tue Nov 17 15:20:25 2020
Adds AmbientTextSelectionColors to allow customizing the colors used for text selection
Also sets the correct Material defaults in MaterialTheme
Bug:
Bug:
Test: MaterialTextSelectionColorsScreenshotTest
Test: TextSelectionColorsScreenshotTest
Test: TextSelectionBackgroundColorTest
Relnote: "MaterialTheme now sets the correct colors for selection handles and selection background. Non-Material apps can manually use AmbientTextSelectionColors to customize the colors used for selection."
Change-Id: I1e6f4b495bdc713e162759a08ecf0a7311b26e33
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldDelegateIntegrationTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreText.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldDelegate.kt
M compose/material/material/api/current.txt
M compose/material/material/api/public_plus_experimental_current.txt
M compose/material/material/api/restricted_current.txt
A compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/MaterialTextSelectionColorsScreenshotTest.kt
A compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTextSelectionColors.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/MaterialTheme.kt
A compose/material/material/src/test/kotlin/androidx/compose/material/TextSelectionBackgroundColorTest.kt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/selection/SelectionHandlesTest.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/selection/TextSelectionColorsScreenshotTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/selection/SelectionHandles.kt
A compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/selection/TextSelectionColors.kt
Description
No description yet.