|
@@ -75,6 +75,7 @@ import androidx.compose.ui.graphics.toArgb
|
|
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalFocusManager
|
|
|
+import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
|
import androidx.compose.ui.platform.LocalView
|
|
|
import androidx.compose.ui.res.colorResource
|
|
|
import androidx.compose.ui.res.painterResource
|
|
@@ -121,6 +122,7 @@ fun ServerList(
|
|
|
val serverListViewModel = serverListViewModelSplash
|
|
|
val basePreferenceHelper = BasePreferenceHelper(context)
|
|
|
isAlphabetList.value = basePreferenceHelper.getFilterList() != filterList[0]
|
|
|
+ searchListViewModelSplash.setCountriesListEmpty()
|
|
|
Box(
|
|
|
modifier = Modifier
|
|
|
.fillMaxSize()
|
|
@@ -763,6 +765,8 @@ fun ColumnScope.ShowSearchBar(
|
|
|
// var isActive by remember { mutableStateOf(false) }
|
|
|
// val searchText = searchListViewModel.searchText.collectAsState().value
|
|
|
|
|
|
+ val keyboardController = LocalSoftwareKeyboardController.current
|
|
|
+ val focusManager = LocalFocusManager.current
|
|
|
val searchListViewModel = searchListViewModelSplash
|
|
|
val scope = rememberCoroutineScope()
|
|
|
var searchText1 by remember { mutableStateOf("") }
|
|
@@ -773,12 +777,13 @@ fun ColumnScope.ShowSearchBar(
|
|
|
|
|
|
LaunchedEffect(key1 = searchText1) {
|
|
|
Log.d("test_search_logic", "LaunchedEffect $searchText1")
|
|
|
- delay(300L)
|
|
|
+ val delay = if (searchText1.isEmpty()) 0L else 300L
|
|
|
+ delay(delay)
|
|
|
searchListViewModel.getCountries(searchText1, true)
|
|
|
}
|
|
|
- if (isActive == false) {
|
|
|
- searchText1 = ""
|
|
|
- }
|
|
|
+// if (isActive == false) {
|
|
|
+// searchText1 = ""
|
|
|
+// }
|
|
|
DockedSearchBar(
|
|
|
query = searchText1,
|
|
|
onQueryChange = {
|
|
@@ -788,9 +793,11 @@ fun ColumnScope.ShowSearchBar(
|
|
|
// }
|
|
|
},
|
|
|
onSearch = {
|
|
|
- scope.launch {
|
|
|
- searchListViewModel.isActiveChange(false)
|
|
|
- }
|
|
|
+// scope.launch {
|
|
|
+// searchListViewModel.isActiveChange(false)
|
|
|
+// }
|
|
|
+// focusManager.clearFocus()
|
|
|
+ keyboardController?.hide()
|
|
|
},
|
|
|
active = isActive!!,
|
|
|
onActiveChange = {
|
|
@@ -814,7 +821,7 @@ fun ColumnScope.ShowSearchBar(
|
|
|
)
|
|
|
},
|
|
|
trailingIcon = {
|
|
|
- if (!isActive) {
|
|
|
+ if (searchText1.isEmpty()) {
|
|
|
IconButton(onClick = { isFilter = true }) {
|
|
|
Icon(
|
|
|
painter = painterResource(id = R.drawable.filter3x),
|