android: switch to MikePenz' Markdown renderer

This commit is contained in:
Harsh Shandilya 2021-10-06 10:50:34 +05:30
parent 5749b98b23
commit 87e9c218a2
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
4 changed files with 8 additions and 14 deletions

View file

@ -22,9 +22,7 @@ dependencies {
implementation(libs.androidx.lifecycle.compose)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.paging.compose)
implementation(libs.compose.richtext.markdown)
implementation(libs.compose.richtext.material)
implementation(libs.compose.richtext.ui)
implementation(libs.multiplatform.markdown.android)
implementation(libs.copydown)
implementation(libs.dagger.hilt.android)
implementation(libs.sqldelight.extensions.coroutines)

View file

@ -28,8 +28,7 @@ import com.google.accompanist.insets.ProvideWindowInsets
import com.google.accompanist.insets.navigationBarsPadding
import com.google.accompanist.insets.statusBarsPadding
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.halilibo.richtext.markdown.Markdown
import com.halilibo.richtext.ui.material.MaterialRichText
import com.mikepenz.markdown.Markdown
import dev.msfjarvis.claw.android.viewmodel.ClawViewModel
import dev.msfjarvis.claw.common.comments.CommentsPage
import dev.msfjarvis.claw.common.theme.LobstersTheme
@ -107,7 +106,7 @@ fun LobstersApp(
getDetails = viewModel::getPostComments,
renderMarkdown = { source, modifier ->
val markdown = copydown.convert(source)
MaterialRichText(modifier = modifier) { Markdown(markdown) }
Markdown(markdown, modifier = modifier)
},
paddingValues = paddingValues,
)

View file

@ -4,12 +4,13 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material.Divider
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
@ -47,9 +48,8 @@ fun CommentEntry(
val startPadding = ((10 * indentLevel) + 16).dp
Divider(color = Color.Gray.copy(0.4f))
Row(modifier = Modifier.wrapContentHeight()) {
// Don't work without IntrinsicSize, which we cannot use with the Android markdown implementation
// CommentTreeColors(indentLevel = indentLevel)
Row(modifier = Modifier.height(IntrinsicSize.Min)) {
CommentTreeColors(indentLevel = indentLevel)
Column(
modifier = Modifier.padding(start = startPadding, end = 8.dp, top = 4.dp, bottom = 4.dp)
) {

View file

@ -3,7 +3,6 @@ accompanist = "0.19.0"
aurora = "0.0.54-SNAPSHOT"
coroutines = "1.5.2"
hilt = "2.39"
richtext = "0.8.1"
serialization = "1.3.0"
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-core = { module = "com.google.dagger:hilt-core", version.ref = "hilt" }
compose-richtext-ui = { module = "com.halilibo.compose-richtext:richtext-ui", version.ref = "richtext" }
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" }
multiplatform-markdown-android = "com.mikepenz:multiplatform-markdown-renderer-android:0.0.1"
copydown = "io.github.furstenheim:copy_down:1.0"
multiplatform-paging = "dev.msfjarvis.paging:multiplatform-paging:0.4.5-SNAPSHOT"