|
@@ -62,6 +62,7 @@ import eu.kanade.presentation.components.LoadingScreen
|
|
import eu.kanade.presentation.components.MangaCover
|
|
import eu.kanade.presentation.components.MangaCover
|
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
|
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
|
import eu.kanade.presentation.util.plus
|
|
import eu.kanade.presentation.util.plus
|
|
|
|
+import eu.kanade.presentation.util.runOnEnterKeyPressed
|
|
import eu.kanade.presentation.util.secondaryItemAlpha
|
|
import eu.kanade.presentation.util.secondaryItemAlpha
|
|
import eu.kanade.tachiyomi.R
|
|
import eu.kanade.tachiyomi.R
|
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
|
@@ -80,6 +81,10 @@ fun TrackServiceSearch(
|
|
) {
|
|
) {
|
|
val focusManager = LocalFocusManager.current
|
|
val focusManager = LocalFocusManager.current
|
|
val focusRequester = remember { FocusRequester() }
|
|
val focusRequester = remember { FocusRequester() }
|
|
|
|
+ val dispatchQueryAndClearFocus: () -> Unit = {
|
|
|
|
+ onDispatchQuery()
|
|
|
|
+ focusManager.clearFocus()
|
|
|
|
+ }
|
|
|
|
|
|
Scaffold(
|
|
Scaffold(
|
|
contentWindowInsets = WindowInsets(
|
|
contentWindowInsets = WindowInsets(
|
|
@@ -106,12 +111,13 @@ fun TrackServiceSearch(
|
|
onValueChange = onQueryChange,
|
|
onValueChange = onQueryChange,
|
|
modifier = Modifier
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.fillMaxWidth()
|
|
- .focusRequester(focusRequester),
|
|
|
|
|
|
+ .focusRequester(focusRequester)
|
|
|
|
+ .runOnEnterKeyPressed(action = dispatchQueryAndClearFocus),
|
|
textStyle = MaterialTheme.typography.bodyLarge
|
|
textStyle = MaterialTheme.typography.bodyLarge
|
|
.copy(color = MaterialTheme.colorScheme.onSurface),
|
|
.copy(color = MaterialTheme.colorScheme.onSurface),
|
|
singleLine = true,
|
|
singleLine = true,
|
|
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
|
|
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
|
|
- keyboardActions = KeyboardActions(onSearch = { focusManager.clearFocus(); onDispatchQuery() }),
|
|
|
|
|
|
+ keyboardActions = KeyboardActions(onSearch = { dispatchQueryAndClearFocus() }),
|
|
cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
|
|
cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
|
|
decorationBox = {
|
|
decorationBox = {
|
|
if (query.text.isEmpty()) {
|
|
if (query.text.isEmpty()) {
|