-
-
Notifications
You must be signed in to change notification settings - Fork 310
Expand file tree
/
Copy pathDeckMessage.kt
More file actions
89 lines (85 loc) · 3.37 KB
/
DeckMessage.kt
File metadata and controls
89 lines (85 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2017-2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package com.nextcloud.talk.ui.chat
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.nextcloud.talk.R
import com.nextcloud.talk.chat.ui.model.ChatMessageUi
import com.nextcloud.talk.chat.ui.model.MessageTypeContent
private val headerTextSize = 16.sp
private val headerIconSize = 18.dp
@Composable
fun DeckMessage(
typeContent: MessageTypeContent.Deck,
message: ChatMessageUi,
isOneToOneConversation: Boolean = false,
conversationThreadId: Long? = null
) {
MessageScaffold(
uiMessage = message,
isOneToOneConversation = isOneToOneConversation,
conversationThreadId = conversationThreadId,
forceTimeBelow = true,
content = {
if (typeContent.cardName.isNotEmpty()) {
val cardDescription = String.format(
LocalResources.current.getString(R.string.deck_card_description),
typeContent.stackName,
typeContent.boardName
)
Surface(
shape = MaterialTheme.shapes.small,
tonalElevation = 1.dp,
modifier = Modifier
.fillMaxWidth()
.padding(start = 8.dp, end = 8.dp, bottom = 8.dp, top = 4.dp)
) {
Column(modifier = Modifier.padding(8.dp)) {
Row {
Icon(
painter = painterResource(R.drawable.deck),
tint = colorScheme.onSurface,
contentDescription = null,
modifier = Modifier
.padding(top = 2.dp, end = 6.dp)
.size(headerIconSize)
.align(Alignment.Top)
)
Text(
text = typeContent.cardName,
fontSize = headerTextSize,
color = colorScheme.onSurface,
fontWeight = FontWeight.SemiBold
)
}
Text(
text = cardDescription,
color = colorScheme.onSurface,
fontSize = headerTextSize
)
}
}
}
}
)
}