Status Update
Comments
si...@google.com <si...@google.com> #2
First of all thanks for this detailed issue.
This issue had been investigated thoroughly when it was first reported internally. The surprising detail in this report is that the issue is not reproducible before 1.7
. I will look into this.
The main problem with POBox is the fact that it is deprecated. Since 2021 Sony has been shipping new Xperia devices with Gboard pre-installed. Although we are aware that there is still a considerable amount of users still using POBox, the described behavior is caused by POBox's noncompliant behavior with InputConnection
and InputMethodManager
documentation. However, this is understandable since TextView
implementation was also not respecting the behavior that is expected from Editors.
Ultimately we have decided to enforce the documented behavior with specifically regards to when editors should call InputMethodManager.updateSelection
. Also, although unconfirmed, there were traces of possible custom code being included in Sony OEM images that changed how InputMethodManager was notified from TextView. If POBox also depended on something like this, it would be impossible for Compose code to replicate the same unknown behavior.
si...@google.com <si...@google.com>
a3...@heb.com <a3...@heb.com> #3
Or is that option not available?
Even if the root cause is POBox, from the perspective of the app's customers, it looks like an app bug, so this issue is a blocker against updating Jetpack Compose.
ra...@tipsport.cz <ra...@tipsport.cz> #4
Just to be sure, it is dangerous to replace Compose TextField with Android View EditText as a workaround for this issue.
Compose 1.7 has a bug that causes ANR when the focus is on EditText.
Another View-related bug in Compose 1.7 is that an Android View is focused by calling FocusManager.clearFocus().
Perhaps there is a lack of testing of Compose 1.7 in combination with Android View. There is also a possibility that there are other fatal bugs related to View.
In other words, the only options for apps targeting the Japanese market that require POBox support are to continue using Compose 1.6 or to use EditText in combination with various workarounds.
su...@evolutepower.com <su...@evolutepower.com> #5
Project: platform/frameworks/support
Branch: androidx-main
Author: Halil Ozercan <
Link:
Fix POBox keyboard issue
Expand for full commit details
Fix POBox keyboard issue
Fix: 373743376
Fix: 329209241
Test: NullableInputConnectionWrapperTest
Change-Id: I94e0e598274fb88b255f977f9fbd50dfbbb1ecb1
Files:
- M
compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapperTest.kt
- M
compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/NullableInputConnectionWrapper.android.kt
Hash: 57f58c4b80d5d8470b2aca325dfdcd55f235231e
Date: Thu Oct 24 01:25:20 2024
sh...@gmail.com <sh...@gmail.com> #6
Many thanks again for this report. Especially for giving us a huge clue in terms of what could be going wrong. The fix is now merged and I will ask for a cherry-pick into a stable release.
so...@google.com <so...@google.com>
ma...@300624.cn <ma...@300624.cn> #7
Do you have any concrete plan to cherry-pick the fix into current stable version (1.7.x)? We are currently waiting it.
ph...@gmail.com <ph...@gmail.com> #8
Yes, this fix is planned to be included in a future 1.7.x
release.
jo...@rvezy.com <jo...@rvezy.com> #9
Thanks for the fix. Sorry to follow up on this. is it possible for you to share specific release version/date for the stable version? We are waiting on this to decide on our direction.
go...@gmail.com <go...@gmail.com> #10
ka...@gmail.com <ka...@gmail.com> #11
bro
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit d8048a5b8e38412aaac604ac84b6ad66e7b7b4f7
Author: Anastasia Soboleva <soboleva@google.com>
Date: Fri Mar 15 17:33:54 2024
Handle <annotation> tag inside String.parseAsHtml
Bug: 139326648
Test: AnnotatedStringFromHtmlTest
Relnote: "Support <annotation> tag inside String.parseAsHtml() method"
Change-Id: I306261acf030feb96e8b8198f88b25375ed9356b
M compose/ui/ui-text/src/androidInstrumentedTest/kotlin/androidx/compose/ui/text/AnnotatedStringFromHtmlTest.kt
M compose/ui/ui-text/src/androidInstrumentedTest/res/values/styled-string-for-test.xml
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/Html.android.kt
pa...@gmail.com <pa...@gmail.com> #13
This would be very useful. In an application that handles a lot of HTML content, the total migration to Jetpack Compose is making it difficult for me.
an...@gmail.com <an...@gmail.com> #14
A new method was added in Compose-UI version 1.7.0-alpha07.
AnnotatedString.fromHtml(htmlString)
It allows to convert a string marked with HTML tags into AnnotatedString.
ro...@google.com <ro...@google.com> #15
Could we expose Spanned.toAnnotatedString()
as a public API?
This would be extremely useful for people using the regular context.getText(<id>)
construct to get their text resources.
I'd even dare to propose textResource(@StringRes Int): AnnotatedString
alongside stringResource(@StringRes Int): String
ma...@marcardar.com <ma...@marcardar.com> #16
#15 How would that work if Spanned
has custom spans?
mi...@iag.com.au <mi...@iag.com.au> #17
Firstly, thank you for your work on this.
I have encountered 2 issues with this alpha version so far.
The first issue I've seen is that the linkStyle SpanStyle isn't working (eg. I can't make the links blue or red etc). My url links work, however I haven't been able to style them correctly yet. Perhaps I've missed something, and if so please kindly provide an example.
The second issue is as follows:
The compose preview isn't working, and the following is the stacktrace
java.lang.NoClassDefFoundError: org/xml/sax/XMLReader at androidx.compose.ui.text.Html_androidKt$TagHandler$1.handleTag(Html.android.kt:246) at android.text.HtmlToSpannedConverter.handleStartTag(Html.java:842) at android.text.HtmlToSpannedConverter.startElement(Html.java:1243) at org.ccil.cowan.tagsoup.Parser.push(Parser.java:795) at org.ccil.cowan.tagsoup.Parser.rectify(Parser.java:1062) at org.ccil.cowan.tagsoup.Parser.stage(Parser.java:1027) at org.ccil.cowan.tagsoup.HTMLScanner.scan(HTMLScanner.java:632) at org.ccil.cowan.tagsoup.Parser.parse(Parser.java:450) at android.text.HtmlToSpannedConverter.convert(Html.java:751) at android.text.Html.fromHtml(Html.java:246) at androidx.core.text.HtmlCompat$Api24Impl.fromHtml(HtmlCompat.java:198) at androidx.core.text.HtmlCompat.fromHtml(HtmlCompat.java:163) at androidx.compose.ui.text.Html_androidKt.fromHtml(Html.android.kt:63) at androidx.compose.ui.text.Html_androidKt.fromHtml$default(Html.android.kt:53)
so...@google.com <so...@google.com> #18
re:
Could you please show a repro of how you're setting the color of the link?
As for the preview issue, it's tracked in
mi...@iag.com.au <mi...@iag.com.au> #19
@Composable
fun HtmlText(
text: String,
style: TextStyle,
modifier: Modifier = Modifier,
textAlign: TextAlign = TextAlign.Start,
linkStyle: SpanStyle = defaultLinkStyle,
linkPressedStyle: SpanStyle = defaultLinkStyle,
linkFocusedStyle: SpanStyle = defaultLinkStyle,
linkHoveredStyle: SpanStyle = defaultLinkStyle,
onLinkSelect: (String) -> Unit = {},
onTagSelect: (String) -> Unit = {},
) {
val html = AnnotatedString.fromHtml(
htmlString = text,
linkStyle = linkStyle,
linkPressedStyle = linkPressedStyle,
linkFocusedStyle = linkFocusedStyle,
linkHoveredStyle = linkHoveredStyle
)
ClickableText(
text = html,
style = style.copy(
color = style.color,
textAlign = textAlign,
platformStyle = PlatformTextStyle(
includeFontPadding = false
),
lineHeightStyle = LineHeightStyle(
alignment = LineHeightStyle.Alignment.Center,
trim = LineHeightStyle.Trim.None
)
),
modifier = modifier,
onClick = {
// handle link
}
)
}
so...@google.com <so...@google.com> #20
re:
How do you call it? Note that it only applies this style to the links, in which case your string needs to be <a href="YOUR_URL">YOUR_TEXT</a>
.
Also don't pass this html string to the ClickableText
(which is deprecated in the latest alpha), pass it directly to the BasicText
or Text
which will handle the link.
mi...@iag.com.au <mi...@iag.com.au> #21
private val defaultLinkStyle = SpanStyle(color = Color.Red)
@Composable
fun HtmlText(
text: String,
style: TextStyle,
modifier: Modifier = Modifier,
textAlign: TextAlign = TextAlign.Start,
linkStyle: SpanStyle = defaultLinkStyle,
linkPressedStyle: SpanStyle = defaultLinkStyle,
linkFocusedStyle: SpanStyle = defaultLinkStyle,
linkHoveredStyle: SpanStyle = defaultLinkStyle,
onLinkSelect: (String) -> Unit = {},
onTagSelect: (String) -> Unit = {},
) {
val html = AnnotatedString.fromHtml(
htmlString = "This is a link test <a href=\"
linkStyle = linkStyle,
linkPressedStyle = linkPressedStyle,
linkFocusedStyle = linkFocusedStyle,
linkHoveredStyle = linkHoveredStyle
) {
Log.d(TAG, "Test")
}
Text(text = html)
BasicText(text = html)
}
so...@google.com <so...@google.com> #22
Re:
mi...@iag.com.au <mi...@iag.com.au> #23
Re:
ka...@gmail.com <ka...@gmail.com> #24
ap...@google.com <ap...@google.com> #25
Project: platform/frameworks/support
Branch: androidx-main
Author: Anastasia Soboleva <
Link:
Add internal APIs to add bullet list from the AnnotatedString builder
Expand for full commit details
Add internal APIs to add bullet list from the AnnotatedString builder
When we're past API freeze, make this APIs public.
Bug: 299662276, 139326648
Test: AnnotatedStringBuilderTest
Change-Id: I2212987ce813ff55cca3d2a4fa4aeb23dd86ec01
Files:
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/SpannableExtensions.android.kt
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/style/BulletSpan.android.kt
- M
compose/ui/ui-text/src/androidUnitTest/kotlin/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
- M
compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
- M
compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Bullet.kt
Hash: eb01d1a28091a1c7c7d370a0000d0a077f6c0d0c
Date: Tue Oct 15 19:21:49 2024
ap...@google.com <ap...@google.com> #26
Project: platform/frameworks/support
Branch: androidx-main
Author: Anastasia Soboleva <
Link:
Add ul/li tags support to fromHtml
Expand for full commit details
Add ul/li tags support to fromHtml
Unlike TextView where indentation is added but bullet is always drawn at 0, in this implementation the bullet follows the start of text in the paragraph meaning that it's drawn with the indentation.
Test: new tests and updated demo
Bug: 299662276, 139326648
Relnote: "AnnotatedString.fromHtml now supports <ul>/<li> tags"
Change-Id: I7c2fe1717e72b66da4b2613efbeeb7b6f5ebb44e
Files:
- M
compose/ui/ui-text/samples/src/main/res/values/styled-string-for-sample.xml
- M
compose/ui/ui-text/src/androidInstrumentedTest/kotlin/androidx/compose/ui/text/AnnotatedStringFromHtmlTest.kt
- M
compose/ui/ui-text/src/androidInstrumentedTest/res/values/styled-string-for-test.xml
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/Html.android.kt
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/SpannableExtensions.android.kt
- A
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/style/BulletSpan.android.kt
- M
compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/style/DrawStyleSpan.android.kt
- M
compose/ui/ui-text/src/androidUnitTest/kotlin/androidx/compose/ui/text/AnnotatedStringBuilderTest.kt
- M
compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt
- A
compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/Bullet.kt
Hash: b6d4b40b1a0ffe65c9869ddcde3f133534a10a89
Date: Tue Oct 15 14:30:50 2024
Description
* It ends up partial and hard to make people happy
* Html in String resources