diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 60b743711b..bc2419f4d0 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -356,7 +356,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa synchronized(apis) { for (api in apis) { if (str.startsWith(api.mainUrl)) { - loadResult(str, api.name) + loadResult(str, api.name, "") return true } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt index dfa7635c13..e045df8ed8 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt @@ -244,7 +244,7 @@ class DownloadFragment : Fragment() { } DOWNLOAD_ACTION_LOAD_RESULT -> { - activity?.loadResult(click.data.url, click.data.apiName) + activity?.loadResult(click.data.url, click.data.apiName, click.data.name) } } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt index 06bbe83a20..07f34ab606 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt @@ -481,7 +481,7 @@ class HomeViewModel : ViewModel() { } fun click(load: LoadClickCallback) { - loadResult(load.response.url, load.response.apiName, load.action) + loadResult(load.response.url, load.response.apiName, load.response.name, load.action) } // only save the key if it is from UI, as we don't want internal functions changing the setting 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 8e3abf058f..64c05bce15 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 @@ -561,6 +561,7 @@ class LibraryFragment : Fragment() { activity?.loadResult( card.url, apiName, + card.name ) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt index 3eab0c7147..c12f011831 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt @@ -124,6 +124,7 @@ fun ResultEpisode.getWatchProgress(): Float { object ResultFragment { private const val URL_BUNDLE = "url" + private const val NAME_BUNDLE = "name" private const val API_NAME_BUNDLE = "apiName" private const val SEASON_BUNDLE = "season" private const val EPISODE_BUNDLE = "episode" @@ -137,6 +138,7 @@ object ResultFragment { return Bundle().apply { putString(URL_BUNDLE, card.url) putString(API_NAME_BUNDLE, card.apiName) + putString(NAME_BUNDLE, card.name) if (card is DataStoreHelper.ResumeWatchingResult) { if (card.season != null) putInt(SEASON_BUNDLE, card.season) @@ -155,12 +157,14 @@ object ResultFragment { fun newInstance( url: String, apiName: String, + name : String, startAction: Int = 0, startValue: Int = 0 ): Bundle { return Bundle().apply { putString(URL_BUNDLE, url) putString(API_NAME_BUNDLE, apiName) + putString(NAME_BUNDLE, name) putInt(START_ACTION_BUNDLE, startAction) putInt(START_VALUE_BUNDLE, startValue) putBoolean(RESTART_BUNDLE, true) @@ -218,6 +222,7 @@ object ResultFragment { data class StoredData( val url: String, val apiName: String, + val name : String, val showFillers: Boolean, val dubStatus: DubStatus, val start: AutoResume?, @@ -230,6 +235,7 @@ object ResultFragment { val settingsManager = PreferenceManager.getDefaultSharedPreferences(context) val url = arguments?.getString(URL_BUNDLE) ?: return null val apiName = arguments?.getString(API_NAME_BUNDLE) ?: return null + val name = arguments?.getString(NAME_BUNDLE) ?: return null val showFillers = settingsManager.getBoolean(context.getString(R.string.show_fillers_key), false) val dubStatus = if (context.getApiDubstatusSettings() @@ -258,7 +264,7 @@ object ResultFragment { season = resumeSeason ) } - return StoredData(url, apiName, showFillers, dubStatus, start, playerAction, restart) + return StoredData(url, apiName, name, showFillers, dubStatus, start, playerAction, restart) } /*private fun reloadViewModel(forceReload: Boolean) { diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragmentPhone.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragmentPhone.kt index d08f3899db..60f9c5ad05 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragmentPhone.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragmentPhone.kt @@ -353,6 +353,11 @@ open class ResultFragmentPhone : FullScreenPlayer() { // ===== ===== ===== + binding?.resultSearch?.isGone = storedData.name.isBlank() + binding?.resultSearch?.setOnClickListener { + QuickSearchFragment.pushSearch(activity, storedData.name) + } + resultBinding?.apply { resultReloadConnectionerror.setOnClickListener { viewModel.load( @@ -745,6 +750,7 @@ open class ResultFragmentPhone : FullScreenPlayer() { } binding?.apply { + resultSearch.isGone = d.title.isBlank() resultSearch.setOnClickListener { QuickSearchFragment.pushSearch(activity, d.title) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt index 7da76dbd7f..9f28965caf 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt @@ -756,15 +756,17 @@ object AppContextUtils { fun loadResult( url: String, apiName: String, + name : String, startAction: Int = 0, startValue: Int = 0 ) { - (activity as FragmentActivity?)?.loadResult(url, apiName, startAction, startValue) + (activity as FragmentActivity?)?.loadResult(url, apiName, name, startAction, startValue) } fun FragmentActivity.loadResult( url: String, apiName: String, + name : String, startAction: Int = 0, startValue: Int = 0 ) { @@ -780,7 +782,7 @@ object AppContextUtils { // viewModelStore.clear() this.navigate( getResultsId(), - ResultFragment.newInstance(url, apiName, startAction, startValue) + ResultFragment.newInstance(url, apiName, name, startAction, startValue) ) } } diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index fafb696829..0ad82bb529 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -43,6 +43,9 @@ +