From 3e65888e637b99834850ba019a8cb30d4151ad06 Mon Sep 17 00:00:00 2001 From: rockhero1234 Date: Wed, 29 Oct 2025 20:25:10 +0530 Subject: [PATCH] separate episode label from title & setting for it --- .../ui/search/SearchResultBuilder.kt | 16 ++++++++++++---- .../cloudstream3/utils/AppContextUtils.kt | 15 +++++++++++++++ app/src/main/res/values-b+es/array.xml | 2 ++ app/src/main/res/values-b+pl/array.xml | 2 ++ app/src/main/res/values-b+tr/array.xml | 2 ++ app/src/main/res/values-b+vi/array.xml | 2 ++ app/src/main/res/values/array.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 8 files changed, 39 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt index c8f9fbcc1d..f1dbf4731b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchResultBuilder.kt @@ -21,6 +21,7 @@ import com.lagradost.cloudstream3.isMovieType import com.lagradost.cloudstream3.syncproviders.SyncAPI import com.lagradost.cloudstream3.ui.settings.Globals.TV import com.lagradost.cloudstream3.ui.settings.Globals.isLayout +import com.lagradost.cloudstream3.utils.AppContextUtils.getEpisodeFull import com.lagradost.cloudstream3.utils.AppContextUtils.getNameFull import com.lagradost.cloudstream3.utils.DataStoreHelper import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual @@ -79,6 +80,7 @@ object SearchResultBuilder { val showSub = showCache[textIsDub?.context?.getString(R.string.show_sub_key)] ?: false val showDub = showCache[textIsDub?.context?.getString(R.string.show_dub_key)] ?: false val showTitle = showCache[cardText?.context?.getString(R.string.show_title_key)] ?: false + val showEpisodeLabel = showCache[cardText?.context?.getString(R.string.show_episode_label_key)] ?: false val showHd = showCache[textQuality?.context?.getString(R.string.show_hd_key)] ?: false val showRatingView = showCache[textQuality?.context?.getString(R.string.show_rating_key)] ?: false @@ -263,10 +265,16 @@ object SearchResultBuilder { } playImg?.visibility = View.VISIBLE + if (card.type?.isMovieType() == false && showEpisodeLabel) { + val context = cardText?.context + val text = when { + showTitle -> context?.getNameFull(card.name, card.episode, card.season) + else -> context?.getEpisodeFull(card.episode, card.season) + } - if (card.type?.isMovieType() == false) { - cardText?.text = - cardText?.context?.getNameFull(card.name, card.episode, card.season) + cardText?.text = text + cardText?.isVisible = true + shadow?.isVisible = true } } @@ -330,4 +338,4 @@ object SearchResultBuilder { backgroundTintList = ColorStateList.valueOf(context.colorFromAttribute(R.attr.textColor)) } } -} \ No newline at end of file +} 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 087f09b6d8..81f605fd71 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt @@ -686,6 +686,21 @@ object AppContextUtils { } return "" } + fun Context.getEpisodeFull(episode: Int?, season: Int?): String { + val rEpisode = if (episode == 0) null else episode + val rSeason = if (season == 0) null else season + val seasonNameShort = getString(R.string.season_short) + val episodeNameShort = getString(R.string.episode_short) + + + return if (rEpisode != null && rSeason != null) { + "$seasonNameShort${rSeason}:$episodeNameShort${rEpisode}" + } else if (rEpisode != null) { + "$episodeNameShort$rEpisode" + }else{ + "" + } + } fun Activity?.loadCache() { try { diff --git a/app/src/main/res/values-b+es/array.xml b/app/src/main/res/values-b+es/array.xml index 40a1be6e07..1172410f62 100644 --- a/app/src/main/res/values-b+es/array.xml +++ b/app/src/main/res/values-b+es/array.xml @@ -147,6 +147,7 @@ @string/show_dub @string/show_sub @string/show_rating + @string/show_episode_label @string/show_title @@ -155,6 +156,7 @@ @string/show_dub_key @string/show_sub_key @string/show_rating_key + @string/show_episode_label_key @string/show_title_key diff --git a/app/src/main/res/values-b+pl/array.xml b/app/src/main/res/values-b+pl/array.xml index db9db9659a..ae07ce1f27 100644 --- a/app/src/main/res/values-b+pl/array.xml +++ b/app/src/main/res/values-b+pl/array.xml @@ -156,6 +156,7 @@ @string/show_dub @string/show_sub @string/show_rating + @string/show_episode_label @string/show_title @@ -164,6 +165,7 @@ @string/show_dub_key @string/show_sub_key @string/show_rating_key + @string/show_episode_label_key @string/show_title_key diff --git a/app/src/main/res/values-b+tr/array.xml b/app/src/main/res/values-b+tr/array.xml index c4c4e4cda4..d95376532f 100644 --- a/app/src/main/res/values-b+tr/array.xml +++ b/app/src/main/res/values-b+tr/array.xml @@ -170,6 +170,7 @@ @string/show_dub @string/show_sub @string/show_rating + @string/show_episode_label @string/show_title @@ -178,6 +179,7 @@ @string/show_dub_key @string/show_sub_key @string/show_rating_key + @string/show_episode_label_key @string/show_title_key diff --git a/app/src/main/res/values-b+vi/array.xml b/app/src/main/res/values-b+vi/array.xml index dbbd0d3c9e..6cb36e90df 100644 --- a/app/src/main/res/values-b+vi/array.xml +++ b/app/src/main/res/values-b+vi/array.xml @@ -148,6 +148,7 @@ @string/show_dub @string/show_sub @string/show_rating + @string/show_episode_label @string/show_title @@ -156,6 +157,7 @@ @string/show_dub_key @string/show_sub_key @string/show_rating_key + @string/show_episode_label_key @string/show_title_key diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 5440a1f0e6..7504a17945 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -207,6 +207,7 @@ @string/show_dub @string/show_sub @string/show_rating + @string/show_episode_label @string/show_title @@ -215,6 +216,7 @@ @string/show_dub_key @string/show_sub_key @string/show_rating_key + @string/show_episode_label_key @string/show_title_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b777ea35c7..bd8cbbb7e0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -406,11 +406,13 @@ Sub label Rating Label Title + Episode Label show_hd_key show_dub_key show_sub_key show_rating_key show_title_key + show_title_label_key Toggle UI elements on poster No Update Found Check for Update