mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Fix browse search query display and keyboard focus (#8781)
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user