mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 15:17:05 +05:30
android: add Comments UI composables
(cherry picked from commit 65c6f8ff52
)
This commit is contained in:
parent
d40e28972d
commit
f2fdfac4ad
2 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,22 @@
|
|||
package dev.msfjarvis.claw.android.comments
|
||||
|
||||
import android.text.Html
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.msfjarvis.claw.model.Comment
|
||||
|
||||
@Composable
|
||||
fun CommentEntry(
|
||||
comment: Comment,
|
||||
) {
|
||||
Row(modifier = Modifier.padding(start = (10 * (comment.indentLevel.toFloat() - 1)).dp)) {
|
||||
Text(
|
||||
text = buildAnnotatedString { @Suppress("DEPRECATION") Html.fromHtml(comment.comment) },
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package dev.msfjarvis.claw.android.comments
|
||||
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.msfjarvis.claw.model.LobstersPostDetails
|
||||
|
||||
@Composable
|
||||
private fun CommentsPageInternal(
|
||||
details: LobstersPostDetails,
|
||||
) {
|
||||
LazyColumn { items(details.comments) { CommentEntry(it) } }
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CommentsPage(
|
||||
postId: String,
|
||||
getDetails: suspend (String) -> LobstersPostDetails,
|
||||
) {}
|
Loading…
Add table
Add a link
Reference in a new issue