chatList and newChatSheet search fields

This commit is contained in:
Avently
2024-10-17 11:45:11 +07:00
parent 3f8d38da23
commit 64ce49f7db
3 changed files with 58 additions and 23 deletions
@@ -166,7 +166,7 @@ fun ChatListView(chatModel: ChatModel, userPickerState: MutableStateFlow<Animate
},
bottomBar = {
if (oneHandUI.value) {
Column(Modifier.imePadding()) {
Column {
Divider()
ChatListToolbar(
userPickerState,
@@ -674,9 +674,12 @@ private fun BoxScope.ChatList(chatModel: ChatModel, searchText: MutableState<Tex
) {
if (oneHandUI.value) {
Divider()
}
ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink)
if (!oneHandUI.value) {
Column(Modifier.consumeWindowInsets(WindowInsets.navigationBars).consumeWindowInsets(PaddingValues(bottom = AppBarHeight))) {
ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink)
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.ime))
}
} else {
ChatListSearchBar(listState, searchText, searchShowingSimplexLink, searchChatFilteredBySimplexLink)
Divider()
}
}
@@ -22,7 +22,7 @@ fun ModalView(
close: () -> Unit,
showClose: Boolean = true,
enableClose: Boolean = true,
background: Color = MaterialTheme.colors.background,
background: Color = Color.Unspecified,
modifier: Modifier = Modifier,
closeOnTop: Boolean = true,
endButtons: @Composable RowScope.() -> Unit = {},
@@ -32,7 +32,7 @@ fun ModalView(
BackHandler(enabled = enableClose, onBack = close)
}
Surface(Modifier.fillMaxSize(), contentColor = LocalContentColor.current) {
Column(if (background != MaterialTheme.colors.background) Modifier.background(background) else Modifier.themedBackground()) {
Column(if (background != Color.Unspecified) Modifier.background(background) else Modifier.themedBackground()) {
if (closeOnTop) {
CloseSheetBar(if (enableClose) close else null, showClose, endButtons = endButtons)
}
@@ -43,9 +43,10 @@ fun ModalData.NewChatSheet(rh: RemoteHostInfo?, close: () -> Unit) {
val oneHandUI = remember { appPrefs.oneHandUI.state }
Scaffold(
backgroundColor = Color.Unspecified,
bottomBar = {
if (oneHandUI.value) {
Column(Modifier.imePadding()) {
Column {
Divider()
CloseSheetBar(
close = close,
@@ -201,6 +202,7 @@ private fun ModalData.NewChatSheetLayout(
}
}
stickyHeader {
val scrolledSomething by remember { derivedStateOf { listState.firstVisibleItemScrollOffset > 0 } }
Column(
Modifier
.offset {
@@ -226,18 +228,36 @@ private fun ModalData.NewChatSheetLayout(
}
IntOffset(0, y)
}
.background(MaterialTheme.colors.background)
// show background when something is scrolled because otherwise the bar is transparent.
// not using background always because of gradient in SimpleX theme
.background(if (scrolledSomething && keyboardState == KeyboardState.Opened) {
MaterialTheme.colors.background
} else {
Color.Unspecified
}
)
) {
Divider()
ContactsSearchBar(
listState = listState,
searchText = searchText,
searchShowingSimplexLink = searchShowingSimplexLink,
searchChatFilteredBySimplexLink = searchChatFilteredBySimplexLink,
close = close,
)
if (!oneHandUI.value) {
ContactsSearchBar(
listState = listState,
searchText = searchText,
searchShowingSimplexLink = searchShowingSimplexLink,
searchChatFilteredBySimplexLink = searchChatFilteredBySimplexLink,
close = close,
)
Divider()
} else {
Column(Modifier.consumeWindowInsets(WindowInsets.navigationBars).consumeWindowInsets(PaddingValues(bottom = AppBarHeight))) {
ContactsSearchBar(
listState = listState,
searchText = searchText,
searchShowingSimplexLink = searchShowingSimplexLink,
searchChatFilteredBySimplexLink = searchChatFilteredBySimplexLink,
close = close,
)
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.ime))
}
}
}
}
@@ -562,9 +582,10 @@ private fun contactTypesSearchTargets(baseContactTypes: List<ContactType>, searc
private fun ModalData.DeletedContactsView(rh: RemoteHostInfo?, closeDeletedChats: () -> Unit, close: () -> Unit) {
val oneHandUI = remember { appPrefs.oneHandUI.state }
Scaffold(
backgroundColor = Color.Unspecified,
bottomBar = {
if (oneHandUI.value) {
Column(Modifier.imePadding()) {
Column {
Divider()
CloseSheetBar(
close = closeDeletedChats,
@@ -615,14 +636,25 @@ private fun ModalData.DeletedContactsView(rh: RemoteHostInfo?, closeDeletedChats
item {
if (!oneHandUI.value) {
Divider()
ContactsSearchBar(
listState = listState,
searchText = searchText,
searchShowingSimplexLink = searchShowingSimplexLink,
searchChatFilteredBySimplexLink = searchChatFilteredBySimplexLink,
close = close,
)
} else {
Column(Modifier.consumeWindowInsets(WindowInsets.navigationBars).consumeWindowInsets(PaddingValues(bottom = AppBarHeight))) {
ContactsSearchBar(
listState = listState,
searchText = searchText,
searchShowingSimplexLink = searchShowingSimplexLink,
searchChatFilteredBySimplexLink = searchChatFilteredBySimplexLink,
close = close,
)
Spacer(Modifier.windowInsetsBottomHeight(WindowInsets.ime))
}
}
ContactsSearchBar(
listState = listState,
searchText = searchText,
searchShowingSimplexLink = searchShowingSimplexLink,
searchChatFilteredBySimplexLink = searchChatFilteredBySimplexLink,
close = close,
)
Divider()
}