mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 18:47:03 +05:30
android: switch to MikePenz' Markdown renderer
This commit is contained in:
parent
5749b98b23
commit
87e9c218a2
4 changed files with 8 additions and 14 deletions
|
@ -22,9 +22,7 @@ dependencies {
|
||||||
implementation(libs.androidx.lifecycle.compose)
|
implementation(libs.androidx.lifecycle.compose)
|
||||||
implementation(libs.androidx.navigation.compose)
|
implementation(libs.androidx.navigation.compose)
|
||||||
implementation(libs.androidx.paging.compose)
|
implementation(libs.androidx.paging.compose)
|
||||||
implementation(libs.compose.richtext.markdown)
|
implementation(libs.multiplatform.markdown.android)
|
||||||
implementation(libs.compose.richtext.material)
|
|
||||||
implementation(libs.compose.richtext.ui)
|
|
||||||
implementation(libs.copydown)
|
implementation(libs.copydown)
|
||||||
implementation(libs.dagger.hilt.android)
|
implementation(libs.dagger.hilt.android)
|
||||||
implementation(libs.sqldelight.extensions.coroutines)
|
implementation(libs.sqldelight.extensions.coroutines)
|
||||||
|
|
|
@ -28,8 +28,7 @@ import com.google.accompanist.insets.ProvideWindowInsets
|
||||||
import com.google.accompanist.insets.navigationBarsPadding
|
import com.google.accompanist.insets.navigationBarsPadding
|
||||||
import com.google.accompanist.insets.statusBarsPadding
|
import com.google.accompanist.insets.statusBarsPadding
|
||||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
import com.halilibo.richtext.markdown.Markdown
|
import com.mikepenz.markdown.Markdown
|
||||||
import com.halilibo.richtext.ui.material.MaterialRichText
|
|
||||||
import dev.msfjarvis.claw.android.viewmodel.ClawViewModel
|
import dev.msfjarvis.claw.android.viewmodel.ClawViewModel
|
||||||
import dev.msfjarvis.claw.common.comments.CommentsPage
|
import dev.msfjarvis.claw.common.comments.CommentsPage
|
||||||
import dev.msfjarvis.claw.common.theme.LobstersTheme
|
import dev.msfjarvis.claw.common.theme.LobstersTheme
|
||||||
|
@ -107,7 +106,7 @@ fun LobstersApp(
|
||||||
getDetails = viewModel::getPostComments,
|
getDetails = viewModel::getPostComments,
|
||||||
renderMarkdown = { source, modifier ->
|
renderMarkdown = { source, modifier ->
|
||||||
val markdown = copydown.convert(source)
|
val markdown = copydown.convert(source)
|
||||||
MaterialRichText(modifier = modifier) { Markdown(markdown) }
|
Markdown(markdown, modifier = modifier)
|
||||||
},
|
},
|
||||||
paddingValues = paddingValues,
|
paddingValues = paddingValues,
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,12 +4,13 @@ import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.IntrinsicSize
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
|
||||||
import androidx.compose.material.Divider
|
import androidx.compose.material.Divider
|
||||||
import androidx.compose.material.Surface
|
import androidx.compose.material.Surface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
@ -47,9 +48,8 @@ fun CommentEntry(
|
||||||
val startPadding = ((10 * indentLevel) + 16).dp
|
val startPadding = ((10 * indentLevel) + 16).dp
|
||||||
|
|
||||||
Divider(color = Color.Gray.copy(0.4f))
|
Divider(color = Color.Gray.copy(0.4f))
|
||||||
Row(modifier = Modifier.wrapContentHeight()) {
|
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
|
||||||
// Don't work without IntrinsicSize, which we cannot use with the Android markdown implementation
|
CommentTreeColors(indentLevel = indentLevel)
|
||||||
// CommentTreeColors(indentLevel = indentLevel)
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.padding(start = startPadding, end = 8.dp, top = 4.dp, bottom = 4.dp)
|
modifier = Modifier.padding(start = startPadding, end = 8.dp, top = 4.dp, bottom = 4.dp)
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -3,7 +3,6 @@ accompanist = "0.19.0"
|
||||||
aurora = "0.0.54-SNAPSHOT"
|
aurora = "0.0.54-SNAPSHOT"
|
||||||
coroutines = "1.5.2"
|
coroutines = "1.5.2"
|
||||||
hilt = "2.39"
|
hilt = "2.39"
|
||||||
richtext = "0.8.1"
|
|
||||||
serialization = "1.3.0"
|
serialization = "1.3.0"
|
||||||
sqldelight = "1.5.1"
|
sqldelight = "1.5.1"
|
||||||
|
|
||||||
|
@ -38,9 +37,7 @@ dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref =
|
||||||
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" }
|
||||||
dagger-hilt-core = { module = "com.google.dagger:hilt-core", version.ref = "hilt" }
|
dagger-hilt-core = { module = "com.google.dagger:hilt-core", version.ref = "hilt" }
|
||||||
|
|
||||||
compose-richtext-ui = { module = "com.halilibo.compose-richtext:richtext-ui", version.ref = "richtext" }
|
multiplatform-markdown-android = "com.mikepenz:multiplatform-markdown-renderer-android:0.0.1"
|
||||||
compose-richtext-material = { module = "com.halilibo.compose-richtext:richtext-ui-material", version.ref = "richtext" }
|
|
||||||
compose-richtext-markdown = { module = "com.halilibo.compose-richtext:richtext-commonmark", version.ref = "richtext" }
|
|
||||||
copydown = "io.github.furstenheim:copy_down:1.0"
|
copydown = "io.github.furstenheim:copy_down:1.0"
|
||||||
|
|
||||||
multiplatform-paging = "dev.msfjarvis.paging:multiplatform-paging:0.4.5-SNAPSHOT"
|
multiplatform-paging = "dev.msfjarvis.paging:multiplatform-paging:0.4.5-SNAPSHOT"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue