Fix background color on internal search fragment.
This commit is contained in:
parent
ddc9aa7506
commit
770a89507a
1 changed files with 24 additions and 17 deletions
|
@ -8,17 +8,20 @@
|
|||
package org.thoughtcrime.securesms.components.settings.app.internal.search
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.contentColorFor
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
@ -52,15 +55,21 @@ class InternalSearchFragment : ComposeFragment() {
|
|||
|
||||
@Composable
|
||||
fun InternalSearchFragmentScreen(query: String, results: ImmutableList<InternalSearchResult>, onSearchUpdated: (String) -> Unit, modifier: Modifier = Modifier) {
|
||||
LazyColumn(
|
||||
modifier = modifier.fillMaxWidth()
|
||||
) {
|
||||
item(key = -1) {
|
||||
SearchBar(query, onSearchUpdated)
|
||||
}
|
||||
results.forEach { recipient ->
|
||||
item(key = recipient.id) {
|
||||
ResultItem(recipient)
|
||||
val backgroundColor = MaterialTheme.colorScheme.surface
|
||||
|
||||
CompositionLocalProvider(LocalContentColor provides contentColorFor(backgroundColor = backgroundColor)) {
|
||||
LazyColumn(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.background(backgroundColor)
|
||||
) {
|
||||
item(key = -1) {
|
||||
SearchBar(query, onSearchUpdated)
|
||||
}
|
||||
results.forEach { recipient ->
|
||||
item(key = recipient.id) {
|
||||
ResultItem(recipient)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +94,9 @@ fun ResultItem(result: InternalSearchResult, modifier: Modifier = Modifier) {
|
|||
.fillMaxWidth()
|
||||
.clickable {
|
||||
if (activity != null) {
|
||||
RecipientBottomSheetDialogFragment.create(result.id, result.groupId).show(activity.supportFragmentManager, "TAG")
|
||||
RecipientBottomSheetDialogFragment
|
||||
.create(result.id, result.groupId)
|
||||
.show(activity.supportFragmentManager, "TAG")
|
||||
}
|
||||
}
|
||||
.padding(8.dp)
|
||||
|
@ -101,9 +112,7 @@ fun ResultItem(result: InternalSearchResult, modifier: Modifier = Modifier) {
|
|||
@Composable
|
||||
fun InternalSearchScreenPreviewLightTheme() {
|
||||
SignalTheme(isDarkMode = false) {
|
||||
Surface {
|
||||
InternalSearchScreenPreview()
|
||||
}
|
||||
InternalSearchScreenPreview()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,9 +120,7 @@ fun InternalSearchScreenPreviewLightTheme() {
|
|||
@Composable
|
||||
fun InternalSearchScreenPreviewDarkTheme() {
|
||||
SignalTheme(isDarkMode = true) {
|
||||
Surface {
|
||||
InternalSearchScreenPreview()
|
||||
}
|
||||
InternalSearchScreenPreview()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue