@@ -9,6 +9,16 @@ import androidx.compose.foundation.layout.Row
9
9
import androidx.compose.foundation.layout.fillMaxWidth
10
10
import androidx.compose.foundation.layout.padding
11
11
import androidx.compose.material.Text
12
+ import androidx.compose.material.icons.Icons
13
+ import androidx.compose.material.icons.automirrored.filled.Reply
14
+ import androidx.compose.material.icons.filled.Block
15
+ import androidx.compose.material.icons.filled.ContentCopy
16
+ import androidx.compose.material.icons.filled.Delete
17
+ import androidx.compose.material.icons.filled.Flag
18
+ import androidx.compose.material.icons.filled.Person
19
+ import androidx.compose.material.icons.filled.PersonRemove
20
+ import androidx.compose.material.icons.filled.Reply
21
+ import androidx.compose.material.icons.filled.VoiceOverOff
12
22
import androidx.compose.runtime.Composable
13
23
import androidx.compose.runtime.State
14
24
import androidx.compose.runtime.derivedStateOf
@@ -20,8 +30,11 @@ import androidx.compose.ui.Alignment
20
30
import androidx.compose.ui.Modifier
21
31
import androidx.compose.ui.draw.drawWithContent
22
32
import androidx.compose.ui.graphics.Shape
33
+ import androidx.compose.ui.graphics.painter.Painter
34
+ import androidx.compose.ui.graphics.vector.rememberVectorPainter
23
35
import androidx.compose.ui.input.pointer.pointerInput
24
36
import androidx.compose.ui.platform.LocalDensity
37
+ import androidx.compose.ui.res.painterResource
25
38
import androidx.compose.ui.res.stringResource
26
39
import androidx.compose.ui.text.AnnotatedString
27
40
import androidx.compose.ui.text.SpanStyle
@@ -46,18 +59,54 @@ import kotlin.math.max
46
59
47
60
sealed interface MessageControlAction {
48
61
val onSelect: () -> Unit
62
+ @get:Composable
63
+ val painter: Painter
64
+ val isDestructive: Boolean
49
65
50
- data class Copy (override val onSelect : () -> Unit ) : MessageControlAction
51
- data class Reply (override val onSelect : () -> Unit ) : MessageControlAction
52
- data class Delete (override val onSelect : () -> Unit ) : MessageControlAction
66
+ data class Copy (override val onSelect : () -> Unit ) : MessageControlAction {
67
+ override val isDestructive: Boolean = false
68
+
69
+ override val painter: Painter
70
+ @Composable get() = rememberVectorPainter(Icons .Default .ContentCopy )
71
+ }
72
+ data class Reply (override val onSelect : () -> Unit ) : MessageControlAction {
73
+ override val isDestructive: Boolean = false
74
+ override val painter: Painter
75
+ @Composable get() = rememberVectorPainter(Icons .AutoMirrored .Default .Reply )
76
+ }
77
+ data class Delete (override val onSelect : () -> Unit ) : MessageControlAction {
78
+ override val isDestructive: Boolean = true
79
+ override val painter: Painter
80
+ @Composable get() = rememberVectorPainter(Icons .Default .Delete )
81
+ }
53
82
data class RemoveUser (val name : String , override val onSelect : () -> Unit ) :
54
- MessageControlAction
83
+ MessageControlAction {
84
+ override val isDestructive: Boolean = true
85
+ override val painter: Painter
86
+ @Composable get() = rememberVectorPainter(Icons .Default .PersonRemove )
87
+ }
55
88
56
- data class MuteUser (val name : String , override val onSelect : () -> Unit ) : MessageControlAction
89
+ data class MuteUser (val name : String , override val onSelect : () -> Unit ) : MessageControlAction {
90
+ override val isDestructive: Boolean = true
91
+ override val painter: Painter
92
+ @Composable get() = rememberVectorPainter(Icons .Default .VoiceOverOff )
93
+ }
57
94
data class ReportUserForMessage (val name : String , override val onSelect : () -> Unit ) :
58
- MessageControlAction
59
- data class BlockUser (val name : String , override val onSelect : () -> Unit ): MessageControlAction
60
- data class UnblockUser (val name : String , override val onSelect : () -> Unit ): MessageControlAction
95
+ MessageControlAction {
96
+ override val isDestructive: Boolean = true
97
+ override val painter: Painter
98
+ @Composable get() = rememberVectorPainter(Icons .Default .Flag )
99
+ }
100
+ data class BlockUser (val name : String , override val onSelect : () -> Unit ): MessageControlAction {
101
+ override val isDestructive: Boolean = true
102
+ override val painter: Painter
103
+ @Composable get() = rememberVectorPainter(Icons .Default .Block )
104
+ }
105
+ data class UnblockUser (val name : String , override val onSelect : () -> Unit ): MessageControlAction {
106
+ override val isDestructive: Boolean = false
107
+ override val painter: Painter
108
+ @Composable get() = rememberVectorPainter(Icons .Default .Person )
109
+ }
61
110
}
62
111
63
112
data class MessageControls (
0 commit comments