@@ -23,20 +23,42 @@ import androidx.compose.foundation.layout.padding
23
23
import androidx.compose.foundation.lazy.LazyColumn
24
24
import androidx.compose.foundation.text.KeyboardOptions
25
25
import androidx.compose.material.icons.Icons
26
- import androidx.compose.material.icons.filled.*
27
- import androidx.compose.material3.*
28
- import androidx.compose.runtime.*
26
+ import androidx.compose.material.icons.filled.Cached
27
+ import androidx.compose.material.icons.filled.Code
28
+ import androidx.compose.material.icons.filled.DeleteForever
29
+ import androidx.compose.material.icons.filled.DoNotDisturbOn
30
+ import androidx.compose.material.icons.filled.HighQuality
31
+ import androidx.compose.material.icons.filled.KeyboardArrowDown
32
+ import androidx.compose.material.icons.filled.KeyboardArrowUp
33
+ import androidx.compose.material.icons.filled.SmartButton
34
+ import androidx.compose.material.icons.filled.Storage
35
+ import androidx.compose.material.icons.filled.Tune
36
+ import androidx.compose.material3.AlertDialog
37
+ import androidx.compose.material3.DropdownMenu
38
+ import androidx.compose.material3.DropdownMenuItem
39
+ import androidx.compose.material3.ExperimentalMaterial3Api
40
+ import androidx.compose.material3.Icon
41
+ import androidx.compose.material3.LargeTopAppBar
42
+ import androidx.compose.material3.MaterialTheme
43
+ import androidx.compose.material3.Scaffold
44
+ import androidx.compose.material3.Text
45
+ import androidx.compose.material3.TextButton
46
+ import androidx.compose.runtime.Composable
47
+ import androidx.compose.runtime.getValue
48
+ import androidx.compose.runtime.mutableStateOf
49
+ import androidx.compose.runtime.remember
50
+ import androidx.compose.runtime.setValue
29
51
import androidx.compose.ui.Modifier
30
52
import androidx.compose.ui.platform.LocalContext
31
53
import androidx.compose.ui.res.stringResource
32
54
import androidx.compose.ui.text.input.KeyboardType
33
55
import androidx.compose.ui.unit.dp
34
56
import androidx.compose.ui.window.DialogProperties
35
- import com.my.kizzy.resources.R
36
- import com.my.kizzy.preference.Prefs
37
57
import com.my.kizzy.data.rpc.Constants
38
58
import com.my.kizzy.data.rpc.Constants.MAX_ALLOWED_CHARACTER_LENGTH
39
59
import com.my.kizzy.domain.model.rpc.RpcButtons
60
+ import com.my.kizzy.preference.Prefs
61
+ import com.my.kizzy.resources.R
40
62
import com.my.kizzy.ui.components.BackButton
41
63
import com.my.kizzy.ui.components.RpcField
42
64
import com.my.kizzy.ui.components.SettingItem
@@ -59,12 +81,18 @@ fun RpcSettings(onBackPressed: () -> Boolean) {
59
81
var rpcButtons by remember {
60
82
mutableStateOf(Json .decodeFromString<RpcButtons >(Prefs [Prefs .RPC_BUTTONS_DATA , " {}" ]))
61
83
}
84
+ var customActivityStatus by remember {
85
+ mutableStateOf(Prefs [Prefs .CUSTOM_ACTIVITY_STATUS , " dnd" ])
86
+ }
62
87
var customActivityType by remember {
63
88
mutableStateOf(Prefs [Prefs .CUSTOM_ACTIVITY_TYPE , 0 ].toString())
64
89
}
65
90
var showActivityTypeDialog by remember {
66
91
mutableStateOf(false )
67
92
}
93
+ var showActivityStatusDialog by remember {
94
+ mutableStateOf(false )
95
+ }
68
96
var setLastRunRpcConfigOption by remember {
69
97
mutableStateOf(Prefs [Prefs .APPLY_FIELDS_FROM_LAST_RUN_RPC , false ])
70
98
}
@@ -121,6 +149,16 @@ fun RpcSettings(onBackPressed: () -> Boolean) {
121
149
) {
122
150
showActivityTypeDialog = true
123
151
}
152
+
153
+ }
154
+ item {
155
+ SettingItem (
156
+ title = " Custom Activity Status" ,
157
+ description = " Overrides the default activity status" ,
158
+ icon = Icons .Default .DoNotDisturbOn
159
+ ) {
160
+ showActivityStatusDialog = true
161
+ }
124
162
}
125
163
item {
126
164
PreferenceSwitch (
@@ -313,5 +351,35 @@ fun RpcSettings(onBackPressed: () -> Boolean) {
313
351
}
314
352
)
315
353
}
354
+
355
+ if (showActivityStatusDialog) {
356
+ AlertDialog (
357
+ onDismissRequest = {
358
+ showActivityStatusDialog = false
359
+ },
360
+ confirmButton = {},
361
+ text = {
362
+ val statusMap = mapOf (
363
+ " Online" to " online" ,
364
+ " AFK" to " idle" ,
365
+ " Do Not Disturb" to " dnd" ,
366
+ " Offline" to " offline" ,
367
+ " Invisible and shown as offline" to " invisible"
368
+ )
369
+ Column {
370
+ statusMap.forEach { (key, value) ->
371
+ SingleChoiceItem (
372
+ text = key,
373
+ selected = value == customActivityStatus
374
+ ) {
375
+ customActivityStatus = value
376
+ Prefs [Prefs .CUSTOM_ACTIVITY_STATUS ] = value
377
+ showActivityStatusDialog = false
378
+ }
379
+ }
380
+ }
381
+ }
382
+ )
383
+ }
316
384
}
317
- }
385
+ }
0 commit comments