mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-23 20:55:02 +01:00
add replies amount to threads overview items
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
57f4e2de1b
commit
429e38e685
@ -25,13 +25,10 @@ import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
@ -211,16 +208,14 @@ fun ThreadsList(
|
||||
val errorPlaceholderImage: Int = R.drawable.account_circle_96dp
|
||||
val imageRequest = loadImage(imageUri, context, errorPlaceholderImage)
|
||||
|
||||
val secondLineText =
|
||||
threadInfo.last?.message ?: (String.format(stringResource(R.string.thread_replies_amount, 0)))
|
||||
|
||||
ThreadRow(
|
||||
roomToken = roomToken,
|
||||
threadId = threadInfo.thread!!.id,
|
||||
firstLineTitle = threadInfo.first?.actorDisplayName.orEmpty(),
|
||||
firstLine = threadInfo.first?.message.orEmpty(),
|
||||
numReplies = String.format(stringResource(R.string.thread_replies_amount, threadInfo.thread?.numReplies ?: 0)),
|
||||
secondLineTitle = threadInfo.last?.actorDisplayName?.let { "$it:" }.orEmpty(),
|
||||
secondLine = secondLineText,
|
||||
secondLine = threadInfo.last?.message.orEmpty(),
|
||||
date = getLastActivityDate(threadInfo), // TODO: replace with value from api when available
|
||||
imageRequest = imageRequest,
|
||||
onClick = onThreadClick
|
||||
|
@ -38,6 +38,7 @@ fun ThreadRow(
|
||||
firstLine: String,
|
||||
secondLineTitle: String,
|
||||
secondLine: String,
|
||||
numReplies: String,
|
||||
date: String,
|
||||
imageRequest: ImageRequest?,
|
||||
onClick: ((String, Int) -> Unit?)?
|
||||
@ -71,6 +72,7 @@ fun ThreadRow(
|
||||
)
|
||||
Spacer(modifier = Modifier.Companion.width(4.dp))
|
||||
Text(
|
||||
modifier = Modifier.Companion.weight(1f),
|
||||
text = firstLine,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
@ -78,6 +80,11 @@ fun ThreadRow(
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Companion.Ellipsis
|
||||
)
|
||||
Text(
|
||||
text = numReplies,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.Companion.height(2.dp))
|
||||
@ -125,6 +132,7 @@ fun ThreadRowPreview() {
|
||||
secondLine = "last message",
|
||||
firstLineTitle = "Marsellus",
|
||||
secondLineTitle = "Mia:",
|
||||
numReplies = "12 replies",
|
||||
date = "14 sec ago",
|
||||
onClick = null,
|
||||
imageRequest = null
|
||||
@ -141,6 +149,7 @@ fun ThreadRowUnreadMessagePreview() {
|
||||
secondLine = "last message",
|
||||
firstLineTitle = "Marsellus",
|
||||
secondLineTitle = "Mia:",
|
||||
numReplies = "12 replies",
|
||||
date = "14 sec ago",
|
||||
onClick = null,
|
||||
imageRequest = null
|
||||
@ -157,6 +166,7 @@ fun ThreadRowMentionPreview() {
|
||||
secondLine = "last message",
|
||||
firstLineTitle = "Marsellus",
|
||||
secondLineTitle = "Mia:",
|
||||
numReplies = "12 replies",
|
||||
date = "14 sec ago",
|
||||
onClick = null,
|
||||
imageRequest = null
|
||||
@ -173,6 +183,7 @@ fun ThreadRowDirectMentionPreview() {
|
||||
secondLine = "last message",
|
||||
firstLineTitle = "Marsellus",
|
||||
secondLineTitle = "Mia:",
|
||||
numReplies = "12 replies",
|
||||
date = "14 sec ago",
|
||||
onClick = null,
|
||||
imageRequest = null
|
||||
|
Loading…
Reference in New Issue
Block a user