Improved suggestion coloring
This commit is contained in:
@@ -483,7 +483,6 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc
|
|||||||
)
|
)
|
||||||
|
|
||||||
val suggestions by remember { contactNames }
|
val suggestions by remember { contactNames }
|
||||||
// 1. Change state to hold AnnotatedStrings
|
|
||||||
var filteredSuggestions by remember { mutableStateOf<List<AnnotatedString>>(emptyList()) }
|
var filteredSuggestions by remember { mutableStateOf<List<AnnotatedString>>(emptyList()) }
|
||||||
var showSuggestions by remember { mutableStateOf(false) }
|
var showSuggestions by remember { mutableStateOf(false) }
|
||||||
val lazyListState = rememberLazyListState()
|
val lazyListState = rememberLazyListState()
|
||||||
@@ -505,7 +504,7 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.shadow(8.dp, RoundedCornerShape(8.dp))
|
.shadow(8.dp, RoundedCornerShape(8.dp))
|
||||||
.background(
|
.background(
|
||||||
color = MaterialTheme.colorScheme.surfaceContainer,
|
color = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
shape = RoundedCornerShape(8.dp)
|
shape = RoundedCornerShape(8.dp)
|
||||||
)
|
)
|
||||||
.animateContentSize()
|
.animateContentSize()
|
||||||
@@ -524,7 +523,6 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc
|
|||||||
state = lazyListState
|
state = lazyListState
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
// 3. Update key and clickable logic
|
|
||||||
items = filteredSuggestions,
|
items = filteredSuggestions,
|
||||||
key = { suggestion -> suggestion.toString() }
|
key = { suggestion -> suggestion.toString() }
|
||||||
) { suggestion ->
|
) { suggestion ->
|
||||||
@@ -538,9 +536,9 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc
|
|||||||
.padding(12.dp)
|
.padding(12.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = suggestion, // Text composable accepts AnnotatedString
|
text = suggestion,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -556,7 +554,6 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc
|
|||||||
onValueChange = {
|
onValueChange = {
|
||||||
newPeer = it
|
newPeer = it
|
||||||
showSuggestions = newPeer.length > 1
|
showSuggestions = newPeer.length > 1
|
||||||
// 2. Update filtering and mapping logic
|
|
||||||
filteredSuggestions = if (it.isEmpty()) {
|
filteredSuggestions = if (it.isEmpty()) {
|
||||||
emptyList()
|
emptyList()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1269,7 +1269,7 @@ private fun CallUriRow(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.shadow(8.dp, RoundedCornerShape(8.dp))
|
.shadow(8.dp, RoundedCornerShape(8.dp))
|
||||||
.background(
|
.background(
|
||||||
color = MaterialTheme.colorScheme.surfaceContainer,
|
color = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
shape = RoundedCornerShape(8.dp)
|
shape = RoundedCornerShape(8.dp)
|
||||||
)
|
)
|
||||||
.animateContentSize()
|
.animateContentSize()
|
||||||
@@ -1306,7 +1306,7 @@ private fun CallUriRow(
|
|||||||
Text(
|
Text(
|
||||||
text = suggestion,
|
text = suggestion,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1662,7 +1662,7 @@ private fun CallRow(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.shadow(8.dp, RoundedCornerShape(8.dp))
|
.shadow(8.dp, RoundedCornerShape(8.dp))
|
||||||
.background(
|
.background(
|
||||||
color = MaterialTheme.colorScheme.surfaceContainerHigh,
|
color = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
shape = RoundedCornerShape(8.dp)
|
shape = RoundedCornerShape(8.dp)
|
||||||
)
|
)
|
||||||
.animateContentSize()
|
.animateContentSize()
|
||||||
@@ -1697,7 +1697,7 @@ private fun CallRow(
|
|||||||
Text(
|
Text(
|
||||||
text = suggestion,
|
text = suggestion,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
fontSize = 18.sp
|
fontSize = 18.sp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user