Status Update
Comments
si...@google.com <si...@google.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
si...@google.com <si...@google.com>
a3...@heb.com <a3...@heb.com> #3
ra...@tipsport.cz <ra...@tipsport.cz> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
su...@evolutepower.com <su...@evolutepower.com> #5
sh...@gmail.com <sh...@gmail.com> #6
When will compose Text support Html or any other markdown
so...@google.com <so...@google.com>
ma...@300624.cn <ma...@300624.cn> #7
ph...@gmail.com <ph...@gmail.com> #8
[Deleted User] <[Deleted User]> #9
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