mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 10:32:34 +00:00
RoomList: improve filter
This commit is contained in:
+6
-2
@@ -23,6 +23,7 @@ import androidx.compose.ui.text.TextStyle
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import io.element.android.x.core.compose.LogCompositions
|
import io.element.android.x.core.compose.LogCompositions
|
||||||
|
import io.element.android.x.core.compose.textFieldState
|
||||||
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
|
import io.element.android.x.designsystem.components.dialogs.ConfirmationDialog
|
||||||
import io.element.android.x.features.roomlist.model.MatrixUser
|
import io.element.android.x.features.roomlist.model.MatrixUser
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ fun RoomListTopBar(
|
|||||||
text = filter,
|
text = filter,
|
||||||
onFilterChanged = onFilterChanged,
|
onFilterChanged = onFilterChanged,
|
||||||
onCloseClicked = {
|
onCloseClicked = {
|
||||||
|
onFilterChanged("")
|
||||||
searchWidgetStateIsOpened = false
|
searchWidgetStateIsOpened = false
|
||||||
},
|
},
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
@@ -68,6 +70,7 @@ fun SearchRoomListTopBar(
|
|||||||
onCloseClicked: () -> Unit,
|
onCloseClicked: () -> Unit,
|
||||||
scrollBehavior: TopAppBarScrollBehavior
|
scrollBehavior: TopAppBarScrollBehavior
|
||||||
) {
|
) {
|
||||||
|
var filterState by textFieldState(stateValue = text)
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -77,11 +80,12 @@ fun SearchRoomListTopBar(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.focusRequester(focusRequester),
|
.focusRequester(focusRequester),
|
||||||
value = text,
|
value = filterState,
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 17.sp
|
fontSize = 17.sp
|
||||||
),
|
),
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
|
filterState = it
|
||||||
onFilterChanged(it)
|
onFilterChanged(it)
|
||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
@@ -100,7 +104,7 @@ fun SearchRoomListTopBar(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Close,
|
imageVector = Icons.Default.Close,
|
||||||
contentDescription = "close",
|
contentDescription = "clear",
|
||||||
tint = MaterialTheme.colorScheme.onBackground
|
tint = MaterialTheme.colorScheme.onBackground
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user