mirror of
https://github.com/twofas/2fas-android.git
synced 2024-11-25 03:40:18 +01:00
Fix search focus when switching between tabs
This commit is contained in:
parent
072b5f1d5e
commit
4fafd68950
@ -33,6 +33,7 @@ interface BottomBarListener {
|
|||||||
internal fun BottomBar(
|
internal fun BottomBar(
|
||||||
selectedIndex: Int,
|
selectedIndex: Int,
|
||||||
listener: BottomBarListener,
|
listener: BottomBarListener,
|
||||||
|
onItemClick: () -> Unit = {},
|
||||||
) {
|
) {
|
||||||
TwNavigationBar {
|
TwNavigationBar {
|
||||||
bottomNavItems.forEachIndexed { index, item ->
|
bottomNavItems.forEachIndexed { index, item ->
|
||||||
@ -43,8 +44,14 @@ internal fun BottomBar(
|
|||||||
showBadge = false,
|
showBadge = false,
|
||||||
onClick = {
|
onClick = {
|
||||||
when {
|
when {
|
||||||
index == 0 && selectedIndex != 0 -> listener.openHome()
|
index == 0 && selectedIndex != 0 -> {
|
||||||
index == 1 && selectedIndex != 1 -> listener.openSettings()
|
onItemClick()
|
||||||
|
listener.openHome()
|
||||||
|
}
|
||||||
|
index == 1 && selectedIndex != 1 -> {
|
||||||
|
onItemClick()
|
||||||
|
listener.openSettings()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -262,7 +262,17 @@ private fun ServicesScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
bottomBar = { BottomBar(0, bottomBarListener) },
|
bottomBar = {
|
||||||
|
BottomBar(
|
||||||
|
selectedIndex = 0,
|
||||||
|
listener = bottomBarListener,
|
||||||
|
onItemClick = {
|
||||||
|
if (uiState.searchFocused) {
|
||||||
|
onSearchFocusChange(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
topBar = {
|
topBar = {
|
||||||
ServicesAppBar(
|
ServicesAppBar(
|
||||||
query = uiState.searchQuery,
|
query = uiState.searchQuery,
|
||||||
|
Loading…
Reference in New Issue
Block a user