Reimplement extensions search

Not sure if I should abstract this out to per-tab though. Maybe when we need it...
This commit is contained in:
arkon
2022-09-03 10:47:48 -04:00
parent 38950f7bc8
commit 21804bfc45
4 changed files with 41 additions and 16 deletions

View File

@@ -21,6 +21,8 @@ fun TabbedScreen(
@StringRes titleRes: Int,
tabs: List<TabContent>,
startIndex: Int? = null,
searchQuery: String? = null,
onChangeSearchQuery: (String?) -> Unit = {},
incognitoMode: Boolean,
downloadedOnlyMode: Boolean,
) {
@@ -35,12 +37,27 @@ fun TabbedScreen(
Scaffold(
topBar = {
AppBar(
title = stringResource(titleRes),
actions = {
AppBarActions(tabs[state.currentPage].actions)
},
)
if (searchQuery == null) {
AppBar(
title = stringResource(titleRes),
actions = {
AppBarActions(tabs[state.currentPage].actions)
},
)
} else {
SearchToolbar(
searchQuery = searchQuery,
onChangeSearchQuery = {
onChangeSearchQuery(it)
},
onClickCloseSearch = {
onChangeSearchQuery(null)
},
onClickResetSearch = {
onChangeSearchQuery("")
},
)
}
},
) { paddingValues ->
Column(modifier = Modifier.padding(paddingValues)) {