Fix search in latest + browse view

This commit is contained in:
Jobobby04 2020-09-17 00:43:38 -04:00
parent a3be1c2c39
commit bd6e048108

View File

@ -11,7 +11,6 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.elvishew.xlog.XLog
import com.github.salomonbrys.kotson.jsonObject import com.github.salomonbrys.kotson.jsonObject
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
@ -29,7 +28,6 @@ import eu.kanade.tachiyomi.ui.browse.source.latest.LatestUpdatesController
import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.manga.MangaController
import exh.util.nullIfBlank import exh.util.nullIfBlank
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onEach
import reactivecircus.flowbinding.android.view.clicks import reactivecircus.flowbinding.android.view.clicks
@ -153,14 +151,13 @@ open class IndexController :
searchView.queryTextEvents() searchView.queryTextEvents()
.filter { router.backstack.lastOrNull()?.controller() == this@IndexController } .filter { router.backstack.lastOrNull()?.controller() == this@IndexController }
.filterIsInstance<QueryTextEvent.QuerySubmitted>() .onEach {
.onEach { onBrowseClick(presenter.query.nullIfBlank()) } if (it is QueryTextEvent.QueryChanged) {
.launchIn(scope) presenter.query = it.queryText.toString()
} else if (it is QueryTextEvent.QuerySubmitted) {
searchView.queryTextEvents() onBrowseClick(presenter.query.nullIfBlank())
.filter { router.backstack.lastOrNull()?.controller() == this@IndexController } }
.filterIsInstance<QueryTextEvent.QueryChanged>() }
.onEach { presenter.query = it.queryText.toString() }
.launchIn(scope) .launchIn(scope)
searchItem.fixExpand( searchItem.fixExpand(
@ -207,7 +204,6 @@ open class IndexController :
filterSheet?.dismiss() filterSheet?.dismiss()
if (!allDefault) { if (!allDefault) {
val json = jsonObject("filters" to filterSerializer.serialize(presenter.sourceFilters)) val json = jsonObject("filters" to filterSerializer.serialize(presenter.sourceFilters))
XLog.nst().json(json.toString())
onBrowseClick(presenter.query.nullIfBlank(), json.toString()) onBrowseClick(presenter.query.nullIfBlank(), json.toString())
} }
}, },