Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this line? If you disable title but enable episode label it looks very weird with no labels on movies but labels on tv-series. Futhermore this breaks the UI as it will push the UI up and down moving everything, if you have mixed set of both movies and tv-series.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested working fine for me

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your continue watching have a row like this where you only have 3~4 items visible at the same time.

"MMMMMEEEEEEMEMEMEMEE" where M = Movie and E = Episode. If you only have movies then it is hidden, but as soon as you scroll to episodes it pops in and moves the entire layout down due to wrap_content. Moving layouts after inflating it is a no-go for UX, and is only done in Cloudstream when it is really needed.

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
}
}

Expand Down Expand Up @@ -330,4 +338,4 @@ object SearchResultBuilder {
backgroundTintList = ColorStateList.valueOf(context.colorFromAttribute(R.attr.textColor))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-b+es/array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<item>@string/show_dub</item>
<item>@string/show_sub</item>
<item>@string/show_rating</item>
<item>@string/show_episode_label</item>
<item>@string/show_title</item>
</array>

Expand All @@ -155,6 +156,7 @@
<item>@string/show_dub_key</item>
<item>@string/show_sub_key</item>
<item>@string/show_rating_key</item>
<item>@string/show_episode_label_key</item>
<item>@string/show_title_key</item>
</array>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-b+pl/array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
<item>@string/show_dub</item>
<item>@string/show_sub</item>
<item>@string/show_rating</item>
<item>@string/show_episode_label</item>
<item>@string/show_title</item>
</array>

Expand All @@ -164,6 +165,7 @@
<item>@string/show_dub_key</item>
<item>@string/show_sub_key</item>
<item>@string/show_rating_key</item>
<item>@string/show_episode_label_key</item>
<item>@string/show_title_key</item>
</array>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-b+tr/array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
<item>@string/show_dub</item>
<item>@string/show_sub</item>
<item>@string/show_rating</item>
<item>@string/show_episode_label</item>
<item>@string/show_title</item>
</array>

Expand All @@ -178,6 +179,7 @@
<item>@string/show_dub_key</item>
<item>@string/show_sub_key</item>
<item>@string/show_rating_key</item>
<item>@string/show_episode_label_key</item>
<item>@string/show_title_key</item>
</array>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-b+vi/array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<item>@string/show_dub</item>
<item>@string/show_sub</item>
<item>@string/show_rating</item>
<item>@string/show_episode_label</item>
<item>@string/show_title</item>
</array>

Expand All @@ -156,6 +157,7 @@
<item>@string/show_dub_key</item>
<item>@string/show_sub_key</item>
<item>@string/show_rating_key</item>
<item>@string/show_episode_label_key</item>
<item>@string/show_title_key</item>
</array>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
<item>@string/show_dub</item>
<item>@string/show_sub</item>
<item>@string/show_rating</item>
<item>@string/show_episode_label</item>
<item>@string/show_title</item>
</array>

Expand All @@ -215,6 +216,7 @@
<item>@string/show_dub_key</item>
<item>@string/show_sub_key</item>
<item>@string/show_rating_key</item>
<item>@string/show_episode_label_key</item>
<item>@string/show_title_key</item>
</array>

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,13 @@
<string name="show_sub">Sub label</string>
<string name="show_rating">Rating Label</string>
<string name="show_title">Title</string>
<string name="show_episode_label">Episode Label</string>
<string name="show_hd_key" translatable="false">show_hd_key</string>
<string name="show_dub_key" translatable="false">show_dub_key</string>
<string name="show_sub_key" translatable="false">show_sub_key</string>
<string name="show_rating_key" translatable="false">show_rating_key</string>
<string name="show_title_key" translatable="false">show_title_key</string>
<string name="show_episode_label_key" translatable="false">show_title_label_key</string>
<string name="poster_ui_settings">Toggle UI elements on poster</string>
<string name="no_update_found">No Update Found</string>
<string name="check_for_update">Check for Update</string>
Expand Down