|
@@ -8,9 +8,8 @@ import androidx.compose.foundation.shape.CircleShape
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
+import androidx.compose.material.icons.automirrored.filled.Send
|
|
|
import androidx.compose.material.icons.filled.Add
|
|
|
-import androidx.compose.material.icons.filled.Face
|
|
|
-import androidx.compose.material.icons.filled.Send
|
|
|
import androidx.compose.material3.*
|
|
|
import androidx.compose.runtime.*
|
|
|
import androidx.compose.runtime.livedata.observeAsState
|
|
@@ -29,7 +28,6 @@ import io.nexilis.service.data.entities.Message
|
|
|
import io.nexilis.service.data.viewmodels.BuddyViewModel
|
|
|
import io.nexilis.service.data.viewmodels.MessageViewModel
|
|
|
|
|
|
-@OptIn(ExperimentalMaterial3Api::class)
|
|
|
@Composable
|
|
|
fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewModel) {
|
|
|
var textInput by rememberSaveable(stateSaver = TextFieldValue.Saver) {
|
|
@@ -61,7 +59,7 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
|
|
|
val m = l[it]
|
|
|
m
|
|
|
}
|
|
|
- ListItem(modifier = Modifier.fillMaxWidth(), headlineText = {
|
|
|
+ ListItem(modifier = Modifier.fillMaxWidth(), headlineContent = {
|
|
|
Row(
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
horizontalArrangement = if (message?.f_pin == me?.f_pin) Arrangement.End else Arrangement.Start
|
|
@@ -70,6 +68,7 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
|
|
|
Spacer(modifier = Modifier.weight(0.2f))
|
|
|
Text(
|
|
|
text = list?.get(it)?.message_text ?: "",
|
|
|
+ color = MaterialTheme.colorScheme.onPrimary,
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
modifier = Modifier
|
|
|
.graphicsLayer {
|
|
@@ -78,12 +77,13 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
|
|
|
clip = true
|
|
|
}
|
|
|
.weight(weight = 0.8f, fill = false)
|
|
|
- .background(color = MaterialTheme.colorScheme.primaryContainer)
|
|
|
+ .background(color = MaterialTheme.colorScheme.primary)
|
|
|
.padding(8.dp)
|
|
|
)
|
|
|
} else {
|
|
|
Text(
|
|
|
text = list?.get(it)?.message_text ?: "",
|
|
|
+ color = MaterialTheme.colorScheme.onSurface,
|
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
|
modifier = Modifier
|
|
|
.graphicsLayer {
|
|
@@ -114,18 +114,20 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
|
|
|
onValueChange = { textInput = it },
|
|
|
label = null,
|
|
|
placeholder = {
|
|
|
- Text(text = "Typing here...")
|
|
|
+ Text(text = "Typing here...", color = MaterialTheme.colorScheme.onPrimary)
|
|
|
},
|
|
|
leadingIcon = {
|
|
|
- IconButton(onClick = { /*TODO*/ }) {
|
|
|
- Icon(imageVector = Icons.Default.Face, contentDescription = "")
|
|
|
+ IconButton(onClick = { }
|
|
|
+ ) {
|
|
|
+ Icon(
|
|
|
+ imageVector = Icons.Default.Add,
|
|
|
+ contentDescription = "",
|
|
|
+ tint = MaterialTheme.colorScheme.onPrimary
|
|
|
+ )
|
|
|
}
|
|
|
},
|
|
|
trailingIcon = {
|
|
|
Row {
|
|
|
- IconButton(onClick = { /*TODO*/ }) {
|
|
|
- Icon(imageVector = Icons.Default.Add, contentDescription = "")
|
|
|
- }
|
|
|
IconButton(onClick = {
|
|
|
if (pin.trim().isEmpty()) {
|
|
|
return@IconButton
|
|
@@ -152,16 +154,22 @@ fun Chat(navController: NavHostController, pin: String, mainViewModel: MainViewM
|
|
|
textInput = TextFieldValue("")
|
|
|
}
|
|
|
}) {
|
|
|
- Icon(imageVector = Icons.Default.Send, contentDescription = "")
|
|
|
+ Icon(
|
|
|
+ imageVector = Icons.AutoMirrored.Filled.Send,
|
|
|
+ contentDescription = "",
|
|
|
+ tint = MaterialTheme.colorScheme.onPrimary
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- colors = TextFieldDefaults.textFieldColors(
|
|
|
- containerColor = MaterialTheme.colorScheme.primaryContainer,
|
|
|
+ colors = TextFieldDefaults.colors(
|
|
|
+ focusedContainerColor = MaterialTheme.colorScheme.primary,
|
|
|
+ unfocusedContainerColor = MaterialTheme.colorScheme.primary,
|
|
|
+ disabledContainerColor = MaterialTheme.colorScheme.primary,
|
|
|
focusedIndicatorColor = Color.Transparent,
|
|
|
unfocusedIndicatorColor = Color.Transparent,
|
|
|
disabledIndicatorColor = Color.Transparent,
|
|
|
- errorIndicatorColor = Color.Transparent
|
|
|
+ errorIndicatorColor = Color.Transparent,
|
|
|
),
|
|
|
keyboardOptions = KeyboardOptions(KeyboardCapitalization.Sentences),
|
|
|
maxLines = 3
|