Skip to content

Update Android #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platforms/android/example-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
implementation libs.timber

implementation libs.androidx.core
implementation platform('org.jetbrains.kotlin:kotlin-bom:2.1.20')
implementation platform('org.jetbrains.kotlin:kotlin-bom:2.1.21')
implementation libs.androidx.lifecycle.runtime
implementation libs.androidx.activity.compose
implementation platform(libs.androidx.compose.bom)
Expand Down
28 changes: 14 additions & 14 deletions platforms/android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
[versions]
activity-compose = "1.10.1"
androidx-junit = "1.2.1"
coroutines = "1.10.1"
compose-bom = "2025.03.00"
lifecycle-runtime-ktx = "2.8.7"
coroutines = "1.10.2"
compose-bom = "2025.06.00"
lifecycle-runtime-ktx = "2.9.1"
timber = "5.0.1"
androidx-core = "1.15.0"
appcompat = "1.7.0"
lifecycle-viewmodel = "2.8.7"
androidx-core = "1.16.0"
appcompat = "1.7.1"
lifecycle-viewmodel = "2.9.1"
material = "1.12.0"
constraintlayout = "2.2.1"
junit = "4.13.2"
robolectric = "4.14.1"
mockk = "1.13.17" # https://github.com/mockk/mockk/issues/1033
mockk = "1.14.2" # https://github.com/mockk/mockk/issues/1033
hamcrest = "3.0"
espresso = "3.6.1"
agp = "8.9.0"
kotlin = "2.1.20"
agp = "8.10.1"
kotlin = "2.1.21"
maven-publish = "0.32.0"
molecule = "2.0.0"
molecule = "2.1.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
rust-android = { id = "org.mozilla.rust-android-gradle.rust-android", version = "0.9.6" }
sonarqube = { id = "org.sonarqube", version = "6.0.1.5171" }
sonarqube = { id = "org.sonarqube", version = "6.2.0.5505" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
maven-publish-base = { id = "com.vanniktech.maven.publish.base", version.ref = "maven-publish" }
jacoco-android = { id = "com.mxalbert.gradle.jacoco-android", version = "0.2.1" }
Expand All @@ -39,7 +39,7 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" }
kotlin-coroutines = { module="org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref="coroutines" }
kotlin-coroutines-android = { module="org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref="coroutines" }
kotlin-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version = "0.3.8" }
kotlin-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version = "0.4.0" }

# Android / Google
androidx-appcompat = { module="androidx.appcompat:appcompat", version.ref="appcompat" }
Expand All @@ -52,7 +52,7 @@ google-material = { module="com.google.android.material:material", version.ref="

# Misc
timber = { module="com.jakewharton.timber:timber", version.ref="timber" }
jsoup = "org.jsoup:jsoup:1.19.1"
jsoup = "org.jsoup:jsoup:1.20.1"
molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" }

# Test
Expand All @@ -61,7 +61,7 @@ test-robolectric = { module="org.robolectric:robolectric", version.ref="robolect
test-mockk = { module="io.mockk:mockk", version.ref="mockk" }
test-hamcrest = { module="org.hamcrest:hamcrest", version.ref="hamcrest" }
test-kotlin-coroutines = { module="org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref="coroutines" }
test-turbine = { module="app.cash.turbine:turbine", version="1.2.0" }
test-turbine = { module="app.cash.turbine:turbine", version="1.2.1" }

# Android Test
test-androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-junit" }
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/library-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dependencies {
implementation libs.timber

implementation libs.androidx.core
implementation platform('org.jetbrains.kotlin:kotlin-bom:2.1.20')
implementation platform('org.jetbrains.kotlin:kotlin-bom:2.1.21')
implementation libs.androidx.lifecycle.runtime
implementation libs.androidx.activity.compose
implementation platform(libs.androidx.compose.bom)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ internal class HtmlToSpansParser(
if (text.isEmpty()) return

val previousSibling = child.previousSibling() as? Element
if (previousSibling != null && previousSibling.isBlock) {
if (previousSibling != null && previousSibling.isBlock && !isLineBreak(previousSibling)) {
append('\n')
}
append(text)
Expand Down Expand Up @@ -299,13 +299,14 @@ internal class HtmlToSpansParser(
}
}

private fun isLineBreak(node: Node?): Boolean {
return node is Element && node.tagName() == "br"
}
Comment on lines +302 to +304
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have gone for a private fun Element.isLineBreak(): Boolean extension function, but this works too.


private fun SpannableStringBuilder.addLeadingLineBreakForBlockNode(element: Element) {
fun isBlankTextNode(node: Node?): Boolean {
return node is TextNode && node.isBlank
}
fun isLineBreak(node: Node?): Boolean {
return node is Element && node.tagName() == "br"
}

// If current element is not a block there's no need to add line breaks
if (!element.isBlock) return
Expand Down
Loading