From 847c70a127e8d0db2683cd7b45259e1354ca7d30 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Tue, 24 Jan 2023 22:38:06 +0100 Subject: [PATCH] Add search option in library --- .../cloudstream3/ui/library/LibraryFragment.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt index 936d0b65..c421f600 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/library/LibraryFragment.kt @@ -22,6 +22,7 @@ import com.lagradost.cloudstream3.mvvm.debugAssert import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.syncproviders.SyncIdName +import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment import com.lagradost.cloudstream3.ui.result.txt import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_LOAD import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_SHOW_METADATA @@ -39,6 +40,7 @@ enum class LibraryOpenerType(@StringRes val stringRes: Int) { Default(R.string.default_subtitles), // TODO FIX AFTER MERGE Provider(R.string.none), Browser(R.string.browser), + Search(R.string.search), None(R.string.none), } @@ -55,6 +57,7 @@ data class ProviderLibraryData( class LibraryFragment : Fragment() { companion object { fun newInstance() = LibraryFragment() + /** * Store which page was last seen when exiting the fragment and returning **/ @@ -152,6 +155,7 @@ class LibraryFragment : Fragment() { txt(LibraryOpenerType.Default.stringRes).asString(this), txt(LibraryOpenerType.None.stringRes).asString(this), txt(LibraryOpenerType.Browser.stringRes).asString(this), + txt(LibraryOpenerType.Search.stringRes).asString(this), ) val items = baseOptions + availableProviders @@ -260,6 +264,12 @@ class LibraryFragment : Fragment() { } LibraryOpenerType.Browser -> openBrowser(searchClickCallback.card.url) + LibraryOpenerType.Search -> { + QuickSearchFragment.pushSearch( + activity, + searchClickCallback.card.name + ) + } } } }