mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 20:31:02 -05:00
Fix browse search query display and keyboard focus (#8781)
This commit is contained in:
parent
8e1b5b4803
commit
a8230ad574
2 changed files with 19 additions and 16 deletions
|
@ -319,6 +319,7 @@ fun SearchToolbar(
|
|||
)
|
||||
LaunchedEffect(searchClickCount) {
|
||||
if (searchQuery == null) return@LaunchedEffect
|
||||
if (searchClickCount == 0 && searchQuery.isNotEmpty()) return@LaunchedEffect
|
||||
try {
|
||||
focusRequester.requestFocus()
|
||||
} catch (_: Throwable) {
|
||||
|
|
|
@ -103,6 +103,24 @@ class BrowseSourceScreenModel(
|
|||
|
||||
val source = sourceManager.get(sourceId) as CatalogueSource
|
||||
|
||||
init {
|
||||
mutableState.update {
|
||||
var query: String? = null
|
||||
var listing = it.listing
|
||||
|
||||
if (listing is Listing.Search) {
|
||||
query = listing.query
|
||||
listing = Listing.Search(query, source.getFilterList())
|
||||
}
|
||||
|
||||
it.copy(
|
||||
listing = listing,
|
||||
filters = source.getFilterList(),
|
||||
toolbarQuery = query,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sheet containing filter items.
|
||||
*/
|
||||
|
@ -132,22 +150,6 @@ class BrowseSourceScreenModel(
|
|||
}
|
||||
.stateIn(coroutineScope, SharingStarted.Lazily, emptyFlow())
|
||||
|
||||
init {
|
||||
mutableState.update {
|
||||
val initialListing = it.listing
|
||||
val listing = if (initialListing is Listing.Search) {
|
||||
initialListing.copy(filters = source.getFilterList())
|
||||
} else {
|
||||
initialListing
|
||||
}
|
||||
|
||||
it.copy(
|
||||
listing = listing,
|
||||
filters = source.getFilterList(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun getColumnsPreference(orientation: Int): GridCells {
|
||||
val isLandscape = orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
val columns = if (isLandscape) {
|
||||
|
|
Loading…
Reference in a new issue