From d91d7742a46ad2bb230b45f1de00c8459c285f69 Mon Sep 17 00:00:00 2001 From: spacedandy-agents-simplex <342056592+spacedandy-agents-simplex@users.noreply.github.com> Date: Wed, 21 Oct 2026 14:46:44 +0000 Subject: [PATCH] android: keep the onboarding cards' size when a keyboard opens over the chat list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the one-hand UI the onboarding chat list shares a column with the search bar, whose keyboard spacer resized the cards whenever any keyboard opened, including the one New chat › Create group opens over the list. The spacer now follows only the search field's own keyboard, so the bar still sits above the keyboard while typing. --- .../common/views/chatlist/ChatListView.kt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt index a8b11800ab..01e314578d 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chatlist/ChatListView.kt @@ -863,11 +863,10 @@ private fun openAppLink(rhId: Long?, uri: String) { } @Composable -private fun ChatListSearchBar(listState: LazyListState, searchText: MutableState, searchShowingSimplexLink: MutableState, searchChatFilteredBySimplexLink: MutableState>, connectNameCandidate: MutableState, onlineSearch: OnlineSearchModel) { +private fun ChatListSearchBar(listState: LazyListState, searchText: MutableState, searchShowingSimplexLink: MutableState, searchChatFilteredBySimplexLink: MutableState>, connectNameCandidate: MutableState, onlineSearch: OnlineSearchModel, focused: MutableState) { Box { Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) { val focusRequester = remember { FocusRequester() } - var focused by remember { mutableStateOf(false) } Icon( painterResource(MR.images.ic_search), contentDescription = null, @@ -875,7 +874,7 @@ private fun ChatListSearchBar(listState: LazyListState, searchText: MutableState tint = MaterialTheme.colors.secondary ) SearchTextField( - Modifier.weight(1f).onFocusChanged { focused = it.hasFocus }.focusRequester(focusRequester), + Modifier.weight(1f).onFocusChanged { focused.value = it.hasFocus }.focusRequester(focusRequester), placeholder = stringResource(MR.strings.search_or_paste_simplex_link), alwaysVisible = true, searchText = searchText, @@ -904,7 +903,7 @@ private fun ChatListSearchBar(listState: LazyListState, searchText: MutableState val focusManager = LocalFocusManager.current val keyboardState = getKeyboardState() LaunchedEffect(keyboardState.value) { - if (keyboardState.value == KeyboardState.Closed && focused) { + if (keyboardState.value == KeyboardState.Closed && focused.value) { focusManager.clearFocus() } } @@ -1212,6 +1211,7 @@ private fun BoxScope.ChatList(searchText: MutableState, listStat @Composable private fun ChatListSearchBarWithTags(listState: LazyListState, searchText: MutableState, searchShowingSimplexLink: MutableState, searchChatFilteredBySimplexLink: MutableState>, connectNameCandidate: MutableState, onlineSearch: OnlineSearchModel) { val oneHandUI = remember { appPrefs.oneHandUI.state } + val searchFocused = remember { mutableStateOf(false) } if (oneHandUI.value) { Column(Modifier.consumeWindowInsets(WindowInsets.navigationBars).consumeWindowInsets(PaddingValues(bottom = AppBarHeight))) { Divider() @@ -1221,11 +1221,14 @@ private fun ChatListSearchBarWithTags(listState: LazyListState, searchText: Muta Divider() rows() } - ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink, connectNameCandidate, onlineSearch) - Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.ime)) + ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink, connectNameCandidate, onlineSearch, searchFocused) + // only the field's own keyboard: one opened by a view over the list must not resize the onboarding cards above + if (searchFocused.value) { + Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.ime)) + } } } else { - ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink, connectNameCandidate, onlineSearch) + ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink, connectNameCandidate, onlineSearch, searchFocused) // top toolbar: search bar above, so on desktop the search rows go above the tags TagsOrConnectByName(searchText, searchShowingSimplexLink, connectNameCandidate, onlineSearch) { rows -> rows()