mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 13:59:48 +01:00
bug with search view alignment
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
6d4e5d2774
commit
05815ebeae
@ -13,6 +13,8 @@ import android.app.Activity
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.wrapContentWidth
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||||
import androidx.compose.material.icons.filled.Search
|
import androidx.compose.material.icons.filled.Search
|
||||||
@ -48,9 +50,13 @@ fun AppBar(
|
|||||||
clickAddButton: (Boolean) -> Unit
|
clickAddButton: (Boolean) -> Unit
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
val appTitle = if(!isSearchActive){
|
||||||
|
title
|
||||||
|
}else{
|
||||||
|
""
|
||||||
|
}
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text(text = title) },
|
title = { Text(text = appTitle) },
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = {
|
IconButton(onClick = {
|
||||||
(context as? Activity)?.finish()
|
(context as? Activity)?.finish()
|
||||||
@ -82,19 +88,19 @@ fun AppBar(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (isSearchActive) {
|
if (isSearchActive) {
|
||||||
Row {
|
Row (modifier = Modifier.fillMaxWidth()) {
|
||||||
SearchComponent(
|
SearchComponent(
|
||||||
text = searchQuery,
|
text = searchQuery,
|
||||||
onTextChange = { searchQuery ->
|
onTextChange = { searchQuery ->
|
||||||
onUpdateSearchQuery(searchQuery)
|
onUpdateSearchQuery(searchQuery)
|
||||||
onUpdateAutocompleteUsers()
|
onUpdateAutocompleteUsers()
|
||||||
},
|
},
|
||||||
onDisableSearch = onDisableSearch
|
onDisableSearch = onDisableSearch,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isAddParticipants) {
|
if (isAddParticipants) {
|
||||||
TextButton(
|
TextButton(
|
||||||
modifier = Modifier.align(Alignment.CenterVertically),
|
modifier = Modifier.align(Alignment.CenterVertically).wrapContentWidth(),
|
||||||
onClick = {
|
onClick = {
|
||||||
onDisableSearch()
|
onDisableSearch()
|
||||||
onUpdateSearchQuery("")
|
onUpdateSearchQuery("")
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
package com.nextcloud.talk.contacts.components
|
package com.nextcloud.talk.contacts.components
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
@ -38,15 +37,15 @@ fun SearchComponent(
|
|||||||
text: String,
|
text: String,
|
||||||
onTextChange: (String) -> Unit,
|
onTextChange: (String) -> Unit,
|
||||||
onDisableSearch: () -> Unit,
|
onDisableSearch: () -> Unit,
|
||||||
|
modifier:Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
TextField(
|
TextField(
|
||||||
modifier = Modifier
|
|
||||||
.background(MaterialTheme.colorScheme.background)
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(60.dp),
|
|
||||||
value = text,
|
value = text,
|
||||||
onValueChange = { onTextChange(it) },
|
onValueChange = { onTextChange(it) },
|
||||||
|
modifier = modifier
|
||||||
|
.background(MaterialTheme.colorScheme.background)
|
||||||
|
.height(60.dp),
|
||||||
placeholder = { Text(text = stringResource(R.string.nc_search)) },
|
placeholder = { Text(text = stringResource(R.string.nc_search)) },
|
||||||
textStyle = TextStyle(fontSize = 16.sp),
|
textStyle = TextStyle(fontSize = 16.sp),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
|
Loading…
Reference in New Issue
Block a user