mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-15 21:47:28 +01:00
Refactor search toolbar and fix browse source (#8360)
This commit is contained in:
@@ -45,7 +45,6 @@ class BrowseController : FullComposeController<BrowsePresenter>, RootController
|
||||
startIndex = 1.takeIf { toExtensions },
|
||||
searchQuery = query,
|
||||
onChangeSearchQuery = { presenter.extensionsPresenter.search(it) },
|
||||
placeholderRes = R.string.action_search_hint,
|
||||
incognitoMode = presenter.isIncognitoMode,
|
||||
downloadedOnlyMode = presenter.isDownloadOnly,
|
||||
)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package eu.kanade.tachiyomi.ui.browse.extension
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Search
|
||||
import androidx.compose.material.icons.outlined.Translate
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -21,13 +20,8 @@ fun extensionsTab(
|
||||
) = TabContent(
|
||||
titleRes = R.string.label_extensions,
|
||||
badgeNumber = presenter.updates.takeIf { it > 0 },
|
||||
searchEnabled = true,
|
||||
actions = listOf(
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.action_search),
|
||||
icon = Icons.Outlined.Search,
|
||||
onClick = { presenter.search("") },
|
||||
),
|
||||
|
||||
AppBar.Action(
|
||||
title = stringResource(R.string.action_filter),
|
||||
icon = Icons.Outlined.Translate,
|
||||
|
||||
@@ -119,11 +119,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
||||
|
||||
private fun navigateUp() {
|
||||
when {
|
||||
presenter.searchQuery != null -> presenter.searchQuery = null
|
||||
presenter.isUserQuery -> {
|
||||
val (_, filters) = presenter.currentFilter as BrowseSourcePresenter.Filter.UserInput
|
||||
presenter.search(query = "", filters = filters)
|
||||
}
|
||||
!presenter.isUserQuery && presenter.searchQuery != null -> presenter.searchQuery = null
|
||||
else -> router.popCurrentController()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,7 @@ open class BrowseSourcePresenter(
|
||||
Filter.valueOf(query ?: "").let {
|
||||
if (it !is Filter.UserInput) {
|
||||
state.currentFilter = it
|
||||
state.searchQuery = null
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user