|
@@ -11,6 +11,7 @@ import androidx.appcompat.widget.SearchView
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import eu.kanade.tachiyomi.R
|
|
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
|
|
+import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|
|
import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding
|
|
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
|
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
|
@@ -22,6 +23,8 @@ import kotlinx.coroutines.flow.launchIn
|
|
|
import kotlinx.coroutines.flow.onEach
|
|
|
import reactivecircus.flowbinding.appcompat.QueryTextEvent
|
|
|
import reactivecircus.flowbinding.appcompat.queryTextEvents
|
|
|
+import uy.kohesive.injekt.api.get
|
|
|
+import uy.kohesive.injekt.injectLazy
|
|
|
|
|
|
/**
|
|
|
* This controller shows and manages the different search result in global search.
|
|
@@ -35,6 +38,8 @@ open class GlobalSearchController(
|
|
|
GlobalSearchCardAdapter.OnMangaClickListener,
|
|
|
GlobalSearchAdapter.OnTitleClickListener {
|
|
|
|
|
|
+ private val preferences: PreferencesHelper by injectLazy()
|
|
|
+
|
|
|
/**
|
|
|
* Adapter containing search results grouped by lang.
|
|
|
*/
|
|
@@ -180,6 +185,12 @@ open class GlobalSearchController(
|
|
|
* @param searchResult result of search.
|
|
|
*/
|
|
|
fun setItems(searchResult: List<GlobalSearchItem>) {
|
|
|
+ if (searchResult.isEmpty() && preferences.searchPinnedSourcesOnly()) {
|
|
|
+ binding.emptyView.show(R.string.no_pinned_sources)
|
|
|
+ } else {
|
|
|
+ binding.emptyView.hide()
|
|
|
+ }
|
|
|
+
|
|
|
adapter?.updateDataSet(searchResult)
|
|
|
}
|
|
|
|