(fix) open keyboard preference

Fix #1434
This commit is contained in:
MM20 2025-06-01 18:48:56 +02:00
parent 7abff7998e
commit 9d3bdb4600
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 8 additions and 1 deletions

View File

@ -138,6 +138,7 @@ abstract class SharedLauncherActivity(
val gestures by viewModel.gestureState.collectAsState()
val searchBarStyle by viewModel.searchBarStyle.collectAsState()
val searchBarColor by viewModel.searchBarColor.collectAsState()
val searchBarAutofocus by viewModel.autoFocusSearch.collectAsState(false)
val widgetsOnHomeScreen by viewModel.widgetsOnHomeScreen.collectAsState()
val fixedRotation by viewModel.fixedRotation.collectAsState()
@ -218,10 +219,12 @@ abstract class SharedLauncherActivity(
hideStatus,
hideNav,
widgetsOnHomeScreen,
searchBarAutofocus,
) {
if (mode == LauncherActivityMode.Assistant) {
val searchComponent = SearchComponent(
reverse = reverseSearchResults,
openKeyboard = searchBarAutofocus,
)
val dismissComponent =
DismissComponent(this@SharedLauncherActivity)
@ -245,6 +248,7 @@ abstract class SharedLauncherActivity(
} else {
val searchComponent = SearchComponent(
reverse = reverseSearchResults,
openKeyboard = searchBarAutofocus,
)
val widgetComponent by lazy { WidgetsComponent }

View File

@ -21,6 +21,7 @@ import de.mm20.launcher2.ui.launcher.search.SearchVM
internal class SearchComponent(
private val reverse: Boolean = false,
private val openKeyboard: Boolean = true,
) : ScaffoldComponent() {
override val isAtTop: MutableState<Boolean?> = mutableStateOf(true)
@ -84,8 +85,10 @@ internal class SearchComponent(
override suspend fun onPreActivate(state: LauncherScaffoldState) {
super.onPreActivate(state)
if (openKeyboard) {
state.isSearchBarFocused = true
}
}
override suspend fun onPreDismiss(state: LauncherScaffoldState) {
super.onPreDismiss(state)