mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
Show message when searching with no pinned sources
This commit is contained in:
parent
abd69d4f91
commit
e95a5be21d
@ -11,6 +11,7 @@ import androidx.appcompat.widget.SearchView
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
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.databinding.GlobalSearchControllerBinding
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
@ -22,6 +23,8 @@ import kotlinx.coroutines.flow.launchIn
|
|||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import reactivecircus.flowbinding.appcompat.QueryTextEvent
|
import reactivecircus.flowbinding.appcompat.QueryTextEvent
|
||||||
import reactivecircus.flowbinding.appcompat.queryTextEvents
|
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.
|
* This controller shows and manages the different search result in global search.
|
||||||
@ -35,6 +38,8 @@ open class GlobalSearchController(
|
|||||||
GlobalSearchCardAdapter.OnMangaClickListener,
|
GlobalSearchCardAdapter.OnMangaClickListener,
|
||||||
GlobalSearchAdapter.OnTitleClickListener {
|
GlobalSearchAdapter.OnTitleClickListener {
|
||||||
|
|
||||||
|
private val preferences: PreferencesHelper by injectLazy()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter containing search results grouped by lang.
|
* Adapter containing search results grouped by lang.
|
||||||
*/
|
*/
|
||||||
@ -180,6 +185,12 @@ open class GlobalSearchController(
|
|||||||
* @param searchResult result of search.
|
* @param searchResult result of search.
|
||||||
*/
|
*/
|
||||||
fun setItems(searchResult: List<GlobalSearchItem>) {
|
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)
|
adapter?.updateDataSet(searchResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,4 +33,11 @@
|
|||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
<eu.kanade.tachiyomi.widget.EmptyView
|
||||||
|
android:id="@+id/empty_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
@ -454,6 +454,7 @@
|
|||||||
<string name="latest">Latest</string>
|
<string name="latest">Latest</string>
|
||||||
<string name="browse">Browse</string>
|
<string name="browse">Browse</string>
|
||||||
<string name="local_source_help_guide">Local source guide</string>
|
<string name="local_source_help_guide">Local source guide</string>
|
||||||
|
<string name="no_pinned_sources">You have no pinned sources</string>
|
||||||
|
|
||||||
<!-- Manga activity -->
|
<!-- Manga activity -->
|
||||||
<string name="manga_not_in_db">This manga has been removed from the database.</string>
|
<string name="manga_not_in_db">This manga has been removed from the database.</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user