mirror of
https://github.com/nextcloud/talk-android
synced 2025-08-03 01:55:40 +01:00
add actor names to thread overview
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
59ced8843e
commit
57f4e2de1b
@ -157,6 +157,7 @@ fun ThreadsOverviewScreen(
|
|||||||
is ThreadsOverviewViewModel.ThreadsListUiState.None -> {
|
is ThreadsOverviewViewModel.ThreadsListUiState.None -> {
|
||||||
LoadingIndicator()
|
LoadingIndicator()
|
||||||
}
|
}
|
||||||
|
|
||||||
is ThreadsOverviewViewModel.ThreadsListUiState.Success -> {
|
is ThreadsOverviewViewModel.ThreadsListUiState.Success -> {
|
||||||
ThreadsList(
|
ThreadsList(
|
||||||
threads = state.threadsList!!,
|
threads = state.threadsList!!,
|
||||||
@ -165,6 +166,7 @@ fun ThreadsOverviewScreen(
|
|||||||
threadsOverviewViewModel
|
threadsOverviewViewModel
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ThreadsOverviewViewModel.ThreadsListUiState.Error -> {
|
is ThreadsOverviewViewModel.ThreadsListUiState.Error -> {
|
||||||
Log.e(TAG, "Error when retrieving threads", uiState.exception)
|
Log.e(TAG, "Error when retrieving threads", uiState.exception)
|
||||||
ErrorView(message = stringResource(R.string.nc_common_error_sorry))
|
ErrorView(message = stringResource(R.string.nc_common_error_sorry))
|
||||||
@ -209,11 +211,16 @@ fun ThreadsList(
|
|||||||
val errorPlaceholderImage: Int = R.drawable.account_circle_96dp
|
val errorPlaceholderImage: Int = R.drawable.account_circle_96dp
|
||||||
val imageRequest = loadImage(imageUri, context, errorPlaceholderImage)
|
val imageRequest = loadImage(imageUri, context, errorPlaceholderImage)
|
||||||
|
|
||||||
|
val secondLineText =
|
||||||
|
threadInfo.last?.message ?: (String.format(stringResource(R.string.thread_replies_amount, 0)))
|
||||||
|
|
||||||
ThreadRow(
|
ThreadRow(
|
||||||
roomToken = roomToken,
|
roomToken = roomToken,
|
||||||
threadId = threadInfo.thread!!.id,
|
threadId = threadInfo.thread!!.id,
|
||||||
|
firstLineTitle = threadInfo.first?.actorDisplayName.orEmpty(),
|
||||||
firstLine = threadInfo.first?.message.orEmpty(),
|
firstLine = threadInfo.first?.message.orEmpty(),
|
||||||
secondLine = threadInfo.last?.message.orEmpty(),
|
secondLineTitle = threadInfo.last?.actorDisplayName?.let { "$it:" }.orEmpty(),
|
||||||
|
secondLine = secondLineText,
|
||||||
date = getLastActivityDate(threadInfo), // TODO: replace with value from api when available
|
date = getLastActivityDate(threadInfo), // TODO: replace with value from api when available
|
||||||
imageRequest = imageRequest,
|
imageRequest = imageRequest,
|
||||||
onClick = onThreadClick
|
onClick = onThreadClick
|
||||||
|
@ -22,6 +22,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -33,7 +34,9 @@ import com.nextcloud.talk.R
|
|||||||
fun ThreadRow(
|
fun ThreadRow(
|
||||||
roomToken: String,
|
roomToken: String,
|
||||||
threadId: Int,
|
threadId: Int,
|
||||||
|
firstLineTitle: String,
|
||||||
firstLine: String,
|
firstLine: String,
|
||||||
|
secondLineTitle: String,
|
||||||
secondLine: String,
|
secondLine: String,
|
||||||
date: String,
|
date: String,
|
||||||
imageRequest: ImageRequest?,
|
imageRequest: ImageRequest?,
|
||||||
@ -57,20 +60,45 @@ fun ThreadRow(
|
|||||||
Spacer(modifier = Modifier.Companion.width(12.dp))
|
Spacer(modifier = Modifier.Companion.width(12.dp))
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
Text(
|
Row {
|
||||||
text = firstLine,
|
Text(
|
||||||
style = MaterialTheme.typography.titleMedium,
|
text = firstLineTitle,
|
||||||
maxLines = 1,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
overflow = TextOverflow.Companion.Ellipsis
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
)
|
fontWeight = FontWeight.Bold,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Companion.Ellipsis
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.Companion.width(4.dp))
|
||||||
|
Text(
|
||||||
|
text = firstLine,
|
||||||
|
style = MaterialTheme.typography.titleSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
fontWeight = FontWeight.Thin,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Companion.Ellipsis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.Companion.height(2.dp))
|
Spacer(modifier = Modifier.Companion.height(2.dp))
|
||||||
|
|
||||||
Row {
|
Row (
|
||||||
|
verticalAlignment = Alignment.Companion.CenterVertically
|
||||||
|
){
|
||||||
|
Text(
|
||||||
|
text = secondLineTitle,
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Companion.Ellipsis
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.Companion.width(4.dp))
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.Companion.weight(1f),
|
modifier = Modifier.Companion.weight(1f),
|
||||||
text = secondLine,
|
text = secondLine,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
maxLines = 2,
|
fontWeight = FontWeight.Thin,
|
||||||
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Companion.Ellipsis
|
overflow = TextOverflow.Companion.Ellipsis
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
@ -95,6 +123,8 @@ fun ThreadRowPreview() {
|
|||||||
threadId = 123,
|
threadId = 123,
|
||||||
firstLine = "first message",
|
firstLine = "first message",
|
||||||
secondLine = "last message",
|
secondLine = "last message",
|
||||||
|
firstLineTitle = "Marsellus",
|
||||||
|
secondLineTitle = "Mia:",
|
||||||
date = "14 sec ago",
|
date = "14 sec ago",
|
||||||
onClick = null,
|
onClick = null,
|
||||||
imageRequest = null
|
imageRequest = null
|
||||||
@ -109,6 +139,8 @@ fun ThreadRowUnreadMessagePreview() {
|
|||||||
threadId = 123,
|
threadId = 123,
|
||||||
firstLine = "first message",
|
firstLine = "first message",
|
||||||
secondLine = "last message",
|
secondLine = "last message",
|
||||||
|
firstLineTitle = "Marsellus",
|
||||||
|
secondLineTitle = "Mia:",
|
||||||
date = "14 sec ago",
|
date = "14 sec ago",
|
||||||
onClick = null,
|
onClick = null,
|
||||||
imageRequest = null
|
imageRequest = null
|
||||||
@ -123,6 +155,8 @@ fun ThreadRowMentionPreview() {
|
|||||||
threadId = 123,
|
threadId = 123,
|
||||||
firstLine = "first message",
|
firstLine = "first message",
|
||||||
secondLine = "last message",
|
secondLine = "last message",
|
||||||
|
firstLineTitle = "Marsellus",
|
||||||
|
secondLineTitle = "Mia:",
|
||||||
date = "14 sec ago",
|
date = "14 sec ago",
|
||||||
onClick = null,
|
onClick = null,
|
||||||
imageRequest = null
|
imageRequest = null
|
||||||
@ -137,6 +171,8 @@ fun ThreadRowDirectMentionPreview() {
|
|||||||
threadId = 123,
|
threadId = 123,
|
||||||
firstLine = "first message",
|
firstLine = "first message",
|
||||||
secondLine = "last message",
|
secondLine = "last message",
|
||||||
|
firstLineTitle = "Marsellus",
|
||||||
|
secondLineTitle = "Mia:",
|
||||||
date = "14 sec ago",
|
date = "14 sec ago",
|
||||||
onClick = null,
|
onClick = null,
|
||||||
imageRequest = null
|
imageRequest = null
|
||||||
|
Loading…
Reference in New Issue
Block a user