From 4b7663538c5b033ef6667624ce95dcec561700ca Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 16 Nov 2026 11:19:57 +0100 Subject: [PATCH 1/4] fix(conversation-list): overlay search loading bar instead of pushing content down Keep the divider in the layout and draw the LinearProgressIndicator on top of the app bar's bottom edge, matching the chat toolbar's loading indicator. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe --- .../ui/ConversationListTopBar.kt | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt index f0af6f6e04c..efda4467b72 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt @@ -259,54 +259,60 @@ private fun TopBarSearchActiveContent( onSearchClose: () -> Unit, focusRequester: FocusRequester ) { - Column { - TopAppBar( - navigationIcon = { - IconButton(onClick = { - onQueryChange("") - onSearchClose() - }) { - Icon( - imageVector = Icons.AutoMirrored.Outlined.ArrowBack, - contentDescription = stringResource(R.string.nc_cancel), - tint = MaterialTheme.colorScheme.onSurface - ) - } - }, - title = { - SearchTextField( - query = query, - onQueryChange = onQueryChange, - focusRequester = focusRequester, - modifier = Modifier.fillMaxWidth() - ) - }, - actions = { - if (query.isNotEmpty()) { + Box { + Column { + TopAppBar( + navigationIcon = { IconButton(onClick = { onQueryChange("") - focusRequester.requestFocus() + onSearchClose() }) { Icon( - imageVector = ImageVector.vectorResource(R.drawable.ic_close_search), - contentDescription = stringResource(R.string.nc_search_clear), - tint = MaterialTheme.colorScheme.onSurfaceVariant + imageVector = Icons.AutoMirrored.Outlined.ArrowBack, + contentDescription = stringResource(R.string.nc_cancel), + tint = MaterialTheme.colorScheme.onSurface ) } - } - }, - colors = TopAppBarDefaults.topAppBarColors( - containerColor = MaterialTheme.colorScheme.surface - ), - windowInsets = WindowInsets(0) - ) + }, + title = { + SearchTextField( + query = query, + onQueryChange = onQueryChange, + focusRequester = focusRequester, + modifier = Modifier.fillMaxWidth() + ) + }, + actions = { + if (query.isNotEmpty()) { + IconButton(onClick = { + onQueryChange("") + focusRequester.requestFocus() + }) { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_close_search), + contentDescription = stringResource(R.string.nc_search_clear), + tint = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + } + }, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = MaterialTheme.colorScheme.surface + ), + windowInsets = WindowInsets(0) + ) + HorizontalDivider() + } + // Drawn on top of the app bar's bottom edge (like in the chat toolbar) so that showing + // the indicator doesn't change the height of the top bar and push the content below. if (isLoading) { LinearProgressIndicator( - modifier = Modifier.fillMaxWidth(), - color = MaterialTheme.colorScheme.primary + modifier = Modifier + .fillMaxWidth() + .align(Alignment.BottomStart), + color = MaterialTheme.colorScheme.primary, + trackColor = MaterialTheme.colorScheme.surface ) - } else { - HorizontalDivider() } } LaunchedEffect(Unit) { focusRequester.requestFocus() } From fd35277b69190206458b2ce269f9c0ec3203489f Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 16 Nov 2026 11:34:37 +0100 Subject: [PATCH 2/4] fix(conversation-list): keep top bar height when activating search The idle search card (58dp) and the active search app bar (64dp + 1dp divider) had different heights, so tapping the search field made the conversation list jump down. Use the same fixed height for both states. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe --- .../talk/conversationlist/ui/ConversationListTopBar.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt index efda4467b72..8e15f62bc5f 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt @@ -40,6 +40,7 @@ import androidx.compose.material3.Badge import androidx.compose.material3.BadgedBox import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults +import androidx.compose.material3.DividerDefaults import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon @@ -157,7 +158,8 @@ private fun TopBarIdleContent(state: ConversationListTopBarState, actions: Conve Row( modifier = Modifier .fillMaxWidth() - .padding(start = 16.dp, end = 4.dp, top = 4.dp, bottom = 4.dp), + .height(SEARCH_TOP_BAR_HEIGHT_DP.dp) + .padding(start = 16.dp, end = 4.dp), verticalAlignment = Alignment.CenterVertically ) { IdleSearchBarCard( @@ -299,6 +301,9 @@ private fun TopBarSearchActiveContent( colors = TopAppBarDefaults.topAppBarColors( containerColor = MaterialTheme.colorScheme.surface ), + // Same total height (incl. divider) as the idle search bar, so that activating the + // search doesn't change the height of the top bar and make the content below jump. + expandedHeight = SEARCH_TOP_BAR_HEIGHT_DP.dp - DividerDefaults.Thickness, windowInsets = WindowInsets(0) ) HorizontalDivider() @@ -439,6 +444,7 @@ private fun buildAvatarImageRequest(url: String?, credentials: String): ImageReq } private const val BADGE_OFFSET_DP = 8 +private const val SEARCH_TOP_BAR_HEIGHT_DP = 58 @Preview(name = "Idle - no filter, no threads - Light") @Preview(name = "Idle - no filter, no threads - Dark", uiMode = Configuration.UI_MODE_NIGHT_YES) From 033657acf28159198e871e727401a1759d9a4060 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 16 Nov 2026 11:48:05 +0100 Subject: [PATCH 3/4] fix(conversation-list): keep rounded search box while typing Instead of swapping the rounded search card for a separate app bar when the search gets activated, keep the same card and only change its content: a back arrow, the text field and a clear button. The avatar, filter and threads buttons are hidden while searching. This keeps the top bar's shape and height, so the content below doesn't jump. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe --- .../ui/ConversationListTopBar.kt | 218 ++++++++---------- 1 file changed, 101 insertions(+), 117 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt index 8e15f62bc5f..c82ae3c748f 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt @@ -40,9 +40,7 @@ import androidx.compose.material3.Badge import androidx.compose.material3.BadgedBox import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults -import androidx.compose.material3.DividerDefaults import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.LinearProgressIndicator @@ -130,15 +128,9 @@ fun ConversationListTopBar( .windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)) ) { when (val mode = state.mode) { - is TopBarMode.SearchBarIdle -> TopBarIdleContent( + is TopBarMode.SearchBarIdle, is TopBarMode.SearchActive -> TopBarSearchContent( state = state, - actions = actions - ) - is TopBarMode.SearchActive -> TopBarSearchActiveContent( - query = mode.query, - isLoading = state.isSearchLoading, - onQueryChange = actions.onSearchQueryChange, - onSearchClose = actions.onSearchClose, + actions = actions, focusRequester = focusRequester ) is TopBarMode.TitleBar -> TopBarTitleContent( @@ -154,64 +146,83 @@ fun ConversationListTopBar( } @Composable -private fun TopBarIdleContent(state: ConversationListTopBarState, actions: ConversationListTopBarActions) { - Row( - modifier = Modifier - .fillMaxWidth() - .height(SEARCH_TOP_BAR_HEIGHT_DP.dp) - .padding(start = 16.dp, end = 4.dp), - verticalAlignment = Alignment.CenterVertically - ) { - IdleSearchBarCard( - state = state, - actions = actions, - modifier = Modifier - .weight(1f) - .height(50.dp) - ) - Spacer(modifier = Modifier.width(8.dp)) - AvatarButton( - avatarUrl = state.avatarUrl, - credentials = state.credentials, - showBadge = state.showAvatarBadge, - onClick = actions.onAvatarClick - ) - } -} - -@Composable -private fun IdleSearchBarCard( +private fun TopBarSearchContent( state: ConversationListTopBarState, actions: ConversationListTopBarActions, - modifier: Modifier = Modifier + focusRequester: FocusRequester ) { - Card( - modifier = modifier, - shape = RoundedCornerShape(25.dp), - elevation = CardDefaults.cardElevation(defaultElevation = 2.dp) - ) { - Box(modifier = Modifier.fillMaxSize()) { - Text( - text = stringResource(R.string.appbar_search_in, stringResource(R.string.nc_app_product_name)), + val activeMode = state.mode as? TopBarMode.SearchActive + Box { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = if (activeMode == null) 4.dp else 16.dp, top = 4.dp, bottom = 4.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Card( + modifier = Modifier + .weight(1f) + .height(50.dp), + shape = RoundedCornerShape(25.dp), + elevation = CardDefaults.cardElevation(defaultElevation = 2.dp) + ) { + if (activeMode == null) { + IdleSearchBarCardContent(state = state, actions = actions) + } else { + ActiveSearchBarCardContent( + query = activeMode.query, + onQueryChange = actions.onSearchQueryChange, + onSearchClose = actions.onSearchClose, + focusRequester = focusRequester + ) + } + } + if (activeMode == null) { + Spacer(modifier = Modifier.width(8.dp)) + AvatarButton( + avatarUrl = state.avatarUrl, + credentials = state.credentials, + showBadge = state.showAvatarBadge, + onClick = actions.onAvatarClick + ) + } + } + // Overlays the bottom edge so that it doesn't change the height of the top bar. + if (activeMode != null && state.isSearchLoading) { + LinearProgressIndicator( modifier = Modifier .fillMaxWidth() - .align(Alignment.CenterStart) - .padding(start = 16.dp, end = if (state.showThreadsButton) 80.dp else 48.dp) - .clickable { actions.onSearchActivate() }, - style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant, - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - IdleSearchBarActions( - state = state, - actions = actions, - modifier = Modifier.align(Alignment.CenterEnd) + .align(Alignment.BottomStart), + color = MaterialTheme.colorScheme.primary, + trackColor = MaterialTheme.colorScheme.surface ) } } } +@Composable +private fun IdleSearchBarCardContent(state: ConversationListTopBarState, actions: ConversationListTopBarActions) { + Box(modifier = Modifier.fillMaxSize()) { + Text( + text = stringResource(R.string.appbar_search_in, stringResource(R.string.nc_app_product_name)), + modifier = Modifier + .fillMaxWidth() + .align(Alignment.CenterStart) + .padding(start = 16.dp, end = if (state.showThreadsButton) 80.dp else 48.dp) + .clickable { actions.onSearchActivate() }, + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurfaceVariant, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) + IdleSearchBarActions( + state = state, + actions = actions, + modifier = Modifier.align(Alignment.CenterEnd) + ) + } +} + @Composable private fun IdleSearchBarActions( state: ConversationListTopBarState, @@ -252,72 +263,46 @@ private fun IdleSearchBarActions( } } -@OptIn(ExperimentalMaterial3Api::class) @Composable -private fun TopBarSearchActiveContent( +private fun ActiveSearchBarCardContent( query: String, - isLoading: Boolean, onQueryChange: (String) -> Unit, onSearchClose: () -> Unit, focusRequester: FocusRequester ) { - Box { - Column { - TopAppBar( - navigationIcon = { - IconButton(onClick = { - onQueryChange("") - onSearchClose() - }) { - Icon( - imageVector = Icons.AutoMirrored.Outlined.ArrowBack, - contentDescription = stringResource(R.string.nc_cancel), - tint = MaterialTheme.colorScheme.onSurface - ) - } - }, - title = { - SearchTextField( - query = query, - onQueryChange = onQueryChange, - focusRequester = focusRequester, - modifier = Modifier.fillMaxWidth() - ) - }, - actions = { - if (query.isNotEmpty()) { - IconButton(onClick = { - onQueryChange("") - focusRequester.requestFocus() - }) { - Icon( - imageVector = ImageVector.vectorResource(R.drawable.ic_close_search), - contentDescription = stringResource(R.string.nc_search_clear), - tint = MaterialTheme.colorScheme.onSurfaceVariant - ) - } - } - }, - colors = TopAppBarDefaults.topAppBarColors( - containerColor = MaterialTheme.colorScheme.surface - ), - // Same total height (incl. divider) as the idle search bar, so that activating the - // search doesn't change the height of the top bar and make the content below jump. - expandedHeight = SEARCH_TOP_BAR_HEIGHT_DP.dp - DividerDefaults.Thickness, - windowInsets = WindowInsets(0) + Row( + modifier = Modifier.fillMaxSize(), + verticalAlignment = Alignment.CenterVertically + ) { + IconButton(onClick = { + onQueryChange("") + onSearchClose() + }) { + Icon( + imageVector = Icons.AutoMirrored.Outlined.ArrowBack, + contentDescription = stringResource(R.string.nc_cancel), + tint = MaterialTheme.colorScheme.onSurface ) - HorizontalDivider() } - // Drawn on top of the app bar's bottom edge (like in the chat toolbar) so that showing - // the indicator doesn't change the height of the top bar and push the content below. - if (isLoading) { - LinearProgressIndicator( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.BottomStart), - color = MaterialTheme.colorScheme.primary, - trackColor = MaterialTheme.colorScheme.surface - ) + SearchTextField( + query = query, + onQueryChange = onQueryChange, + focusRequester = focusRequester, + modifier = Modifier + .weight(1f) + .padding(end = if (query.isEmpty()) 16.dp else 0.dp) + ) + if (query.isNotEmpty()) { + IconButton(onClick = { + onQueryChange("") + focusRequester.requestFocus() + }) { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_close_search), + contentDescription = stringResource(R.string.nc_search_clear), + tint = MaterialTheme.colorScheme.onSurfaceVariant + ) + } } } LaunchedEffect(Unit) { focusRequester.requestFocus() } @@ -444,7 +429,6 @@ private fun buildAvatarImageRequest(url: String?, credentials: String): ImageReq } private const val BADGE_OFFSET_DP = 8 -private const val SEARCH_TOP_BAR_HEIGHT_DP = 58 @Preview(name = "Idle - no filter, no threads - Light") @Preview(name = "Idle - no filter, no threads - Dark", uiMode = Configuration.UI_MODE_NIGHT_YES) From 7cdba2d1a5ca1d9037581276e765f331b42d5245 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 16 Nov 2026 11:52:55 +0100 Subject: [PATCH 4/4] feat(conversation-list): animate search bar transition Animate hiding and showing the avatar, filter and threads buttons when the search gets activated or closed. The back arrow and clear button fade in and out, and the paddings animate so the search card and its text move smoothly instead of jumping. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marcel Hibbe --- .../ui/ConversationListTopBar.kt | 213 ++++++++++-------- 1 file changed, 124 insertions(+), 89 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt index c82ae3c748f..6c2f8ac033d 100644 --- a/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt +++ b/app/src/main/java/com/nextcloud/talk/conversationlist/ui/ConversationListTopBar.kt @@ -11,6 +11,12 @@ package com.nextcloud.talk.conversationlist.ui import android.content.res.Configuration import androidx.activity.compose.BackHandler +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.core.animateDpAsState +import androidx.compose.animation.expandHorizontally +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.shrinkHorizontally import androidx.compose.foundation.clickable import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Box @@ -53,6 +59,7 @@ import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -152,11 +159,13 @@ private fun TopBarSearchContent( focusRequester: FocusRequester ) { val activeMode = state.mode as? TopBarMode.SearchActive + val isActive = activeMode != null + val endPadding by animateDpAsState(if (isActive) 16.dp else 4.dp, label = "searchBarEndPadding") Box { Row( modifier = Modifier .fillMaxWidth() - .padding(start = 16.dp, end = if (activeMode == null) 4.dp else 16.dp, top = 4.dp, bottom = 4.dp), + .padding(start = 16.dp, end = endPadding, top = 4.dp, bottom = 4.dp), verticalAlignment = Alignment.CenterVertically ) { Card( @@ -166,29 +175,31 @@ private fun TopBarSearchContent( shape = RoundedCornerShape(25.dp), elevation = CardDefaults.cardElevation(defaultElevation = 2.dp) ) { - if (activeMode == null) { - IdleSearchBarCardContent(state = state, actions = actions) - } else { - ActiveSearchBarCardContent( - query = activeMode.query, - onQueryChange = actions.onSearchQueryChange, - onSearchClose = actions.onSearchClose, - focusRequester = focusRequester + SearchBarCardContent( + state = state, + actions = actions, + query = activeMode?.query, + focusRequester = focusRequester + ) + } + AnimatedVisibility( + visible = !isActive, + enter = fadeIn() + expandHorizontally(), + exit = fadeOut() + shrinkHorizontally() + ) { + Row(verticalAlignment = Alignment.CenterVertically) { + Spacer(modifier = Modifier.width(8.dp)) + AvatarButton( + avatarUrl = state.avatarUrl, + credentials = state.credentials, + showBadge = state.showAvatarBadge, + onClick = actions.onAvatarClick ) } } - if (activeMode == null) { - Spacer(modifier = Modifier.width(8.dp)) - AvatarButton( - avatarUrl = state.avatarUrl, - credentials = state.credentials, - showBadge = state.showAvatarBadge, - onClick = actions.onAvatarClick - ) - } } // Overlays the bottom edge so that it doesn't change the height of the top bar. - if (activeMode != null && state.isSearchLoading) { + if (isActive && state.isSearchLoading) { LinearProgressIndicator( modifier = Modifier .fillMaxWidth() @@ -200,25 +211,101 @@ private fun TopBarSearchContent( } } +/** + * Content of the rounded search card. [query] is null while the search is idle. + */ @Composable -private fun IdleSearchBarCardContent(state: ConversationListTopBarState, actions: ConversationListTopBarActions) { - Box(modifier = Modifier.fillMaxSize()) { - Text( - text = stringResource(R.string.appbar_search_in, stringResource(R.string.nc_app_product_name)), - modifier = Modifier - .fillMaxWidth() - .align(Alignment.CenterStart) - .padding(start = 16.dp, end = if (state.showThreadsButton) 80.dp else 48.dp) - .clickable { actions.onSearchActivate() }, - style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant, - maxLines = 1, - overflow = TextOverflow.Ellipsis +private fun SearchBarCardContent( + state: ConversationListTopBarState, + actions: ConversationListTopBarActions, + query: String?, + focusRequester: FocusRequester +) { + val isActive = query != null + val showClearButton = !query.isNullOrEmpty() + val textStartPadding by animateDpAsState(if (isActive) 0.dp else 16.dp, label = "searchTextStartPadding") + val textEndPadding by animateDpAsState( + if (isActive && !showClearButton) 16.dp else 0.dp, + label = "searchTextEndPadding" + ) + Row( + modifier = Modifier.fillMaxSize(), + verticalAlignment = Alignment.CenterVertically + ) { + AnimatedVisibility( + visible = isActive, + enter = fadeIn() + expandHorizontally(), + exit = fadeOut() + shrinkHorizontally() + ) { + SearchBackButton(onClick = { + actions.onSearchQueryChange("") + actions.onSearchClose() + }) + } + val textModifier = Modifier + .weight(1f) + .padding(start = textStartPadding, end = textEndPadding) + if (query != null) { + SearchTextField( + query = query, + onQueryChange = actions.onSearchQueryChange, + focusRequester = focusRequester, + modifier = textModifier + ) + LaunchedEffect(Unit) { focusRequester.requestFocus() } + } else { + SearchPlaceholder(modifier = textModifier.clickable { actions.onSearchActivate() }) + } + AnimatedVisibility( + visible = showClearButton, + enter = fadeIn(), + exit = fadeOut() + ) { + SearchClearButton(onClick = { + actions.onSearchQueryChange("") + focusRequester.requestFocus() + }) + } + AnimatedVisibility( + visible = !isActive, + enter = fadeIn() + expandHorizontally(), + exit = fadeOut() + shrinkHorizontally() + ) { + IdleSearchBarActions(state = state, actions = actions) + } + } +} + +@Composable +private fun SearchPlaceholder(modifier: Modifier = Modifier) { + Text( + text = stringResource(R.string.appbar_search_in, stringResource(R.string.nc_app_product_name)), + modifier = modifier, + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurfaceVariant, + maxLines = 1, + overflow = TextOverflow.Ellipsis + ) +} + +@Composable +private fun SearchBackButton(onClick: () -> Unit) { + IconButton(onClick = onClick) { + Icon( + imageVector = Icons.AutoMirrored.Outlined.ArrowBack, + contentDescription = stringResource(R.string.nc_cancel), + tint = MaterialTheme.colorScheme.onSurface ) - IdleSearchBarActions( - state = state, - actions = actions, - modifier = Modifier.align(Alignment.CenterEnd) + } +} + +@Composable +private fun SearchClearButton(onClick: () -> Unit) { + IconButton(onClick = onClick) { + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_close_search), + contentDescription = stringResource(R.string.nc_search_clear), + tint = MaterialTheme.colorScheme.onSurfaceVariant ) } } @@ -263,51 +350,6 @@ private fun IdleSearchBarActions( } } -@Composable -private fun ActiveSearchBarCardContent( - query: String, - onQueryChange: (String) -> Unit, - onSearchClose: () -> Unit, - focusRequester: FocusRequester -) { - Row( - modifier = Modifier.fillMaxSize(), - verticalAlignment = Alignment.CenterVertically - ) { - IconButton(onClick = { - onQueryChange("") - onSearchClose() - }) { - Icon( - imageVector = Icons.AutoMirrored.Outlined.ArrowBack, - contentDescription = stringResource(R.string.nc_cancel), - tint = MaterialTheme.colorScheme.onSurface - ) - } - SearchTextField( - query = query, - onQueryChange = onQueryChange, - focusRequester = focusRequester, - modifier = Modifier - .weight(1f) - .padding(end = if (query.isEmpty()) 16.dp else 0.dp) - ) - if (query.isNotEmpty()) { - IconButton(onClick = { - onQueryChange("") - focusRequester.requestFocus() - }) { - Icon( - imageVector = ImageVector.vectorResource(R.drawable.ic_close_search), - contentDescription = stringResource(R.string.nc_search_clear), - tint = MaterialTheme.colorScheme.onSurfaceVariant - ) - } - } - } - LaunchedEffect(Unit) { focusRequester.requestFocus() } -} - @Composable private fun SearchTextField( query: String, @@ -331,14 +373,7 @@ private fun SearchTextField( decorationBox = { innerTextField -> Box(contentAlignment = Alignment.CenterStart) { if (query.isEmpty()) { - Text( - text = stringResource( - R.string.appbar_search_in, - stringResource(R.string.nc_app_product_name) - ), - style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurfaceVariant - ) + SearchPlaceholder() } innerTextField() }