Fixed
Status Update
Comments
kl...@google.com <kl...@google.com>
kl...@google.com <kl...@google.com> #2
We can't land this change until the next alpha, but I've tried two approaches:
- As requested in the bug,
https://android-review.googlesource.com/c/platform/frameworks/support/+/2083836 makesBuilder
implementAppendable
. However, this is not feasible as a non-breaking change becauseBuilder
already has anappend(Char)
method with a different return type. - Added an
asAppendable
method that returns the underlyingStringBuilder
:https://android-review.googlesource.com/c/platform/frameworks/support/+/2083837 It's basically just as cheap as just implementingAppendable
directly, but more awkward to use. But it's backwards-compatible, so might be our only option.
ed...@gmail.com <ed...@gmail.com> #3
Nice. #2 sounds good, maybe with a joinToAnnotatedString
wrapper method to hide the awkwardness?
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit a6ac6a81890f1e47202f0babe8dfbc4abaf8e6f1
Author: Zach Klippenstein <klippenstein@google.com>
Date: Mon May 02 08:43:01 2022
Make AnnotatedString.Builder implement Appendable.
Fixes: b/231030444
Test: ./gradlew :compose:ui:ui-text:tDUT
Relnote: "`AnnotatedString.Builder` now implements `kotlin.text.Appendable`."
Relnote: "`AnnotatedString.Builder` now has an
`append(AnnotatedString, start: Int, end: Int)` method to append
a substring of an `AnnotatedString` and the intersecting styles."
Change-Id: I1a061f42c46b21f00320b5b31fa717b8d57fd919
M compose/ui/ui-text/api/restricted_current.txt
A compose/ui/ui-text/api/restricted_current.ignore
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
A compose/ui/ui-text/api/current.ignore
M compose/ui/ui-text/api/public_plus_experimental_current.txt
M compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
M compose/ui/ui-text/samples/src/main/java/androidx/compose/ui/text/samples/AnnotatedStringBuilderSamples.kt
M compose/ui/ui-text/api/current.txt
https://android-review.googlesource.com/2083836
Branch: androidx-main
commit a6ac6a81890f1e47202f0babe8dfbc4abaf8e6f1
Author: Zach Klippenstein <klippenstein@google.com>
Date: Mon May 02 08:43:01 2022
Make AnnotatedString.Builder implement Appendable.
Fixes:
Test: ./gradlew :compose:ui:ui-text:tDUT
Relnote: "`AnnotatedString.Builder` now implements `kotlin.text.Appendable`."
Relnote: "`AnnotatedString.Builder` now has an
`append(AnnotatedString, start: Int, end: Int)` method to append
a substring of an `AnnotatedString` and the intersecting styles."
Change-Id: I1a061f42c46b21f00320b5b31fa717b8d57fd919
M compose/ui/ui-text/api/restricted_current.txt
A compose/ui/ui-text/api/restricted_current.ignore
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
A compose/ui/ui-text/api/current.ignore
M compose/ui/ui-text/api/public_plus_experimental_current.txt
M compose/ui/ui-text/src/test/java/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
M compose/ui/ui-text/samples/src/main/java/androidx/compose/ui/text/samples/AnnotatedStringBuilderSamples.kt
M compose/ui/ui-text/api/current.txt
na...@google.com <na...@google.com> #5
The following release(s) address this bug:
androidx.compose.ui:ui-text:1.4.0-alpha01
Description
It would be nice to be able to use
Iterable<T>.joinTo
withAnnotatedString.Builder
but the latter would need to implement theAppendable
interface first