mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Show Season number for next airing episode (#1071)
This commit is contained in:
parent
3874cb9f9d
commit
f1cc4db89c
4 changed files with 38 additions and 22 deletions
|
@ -1448,11 +1448,24 @@ fun TvType?.isEpisodeBased(): Boolean {
|
||||||
return (this == TvType.TvSeries || this == TvType.Anime || this == TvType.AsianDrama)
|
return (this == TvType.TvSeries || this == TvType.Anime || this == TvType.AsianDrama)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data class NextAiring(
|
data class NextAiring(
|
||||||
val episode: Int,
|
val episode: Int,
|
||||||
val unixTime: Long,
|
val unixTime: Long,
|
||||||
)
|
val season: Int? = null,
|
||||||
|
) {
|
||||||
|
/**
|
||||||
|
* Secondary constructor for backwards compatibility without season.
|
||||||
|
* TODO Remove this constructor after there is a new stable release and extensions are updated to support season.
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
episode: Int,
|
||||||
|
unixTime: Long,
|
||||||
|
) : this (
|
||||||
|
episode,
|
||||||
|
unixTime,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param season To be mapped with episode season, not shown in UI if displaySeason is defined
|
* @param season To be mapped with episode season, not shown in UI if displaySeason is defined
|
||||||
|
|
|
@ -197,7 +197,11 @@ fun LoadResponse.toResultData(repo: APIRepository): ResultData {
|
||||||
|
|
||||||
else -> null
|
else -> null
|
||||||
}?.also {
|
}?.also {
|
||||||
nextAiringEpisode = txt(R.string.next_episode_format, airing.episode)
|
nextAiringEpisode = when (airing.season) {
|
||||||
|
|
||||||
|
null -> txt(R.string.next_episode_format, airing.episode)
|
||||||
|
else -> txt(R.string.next_season_episode_format, airing.season, airing.episode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,42 +178,40 @@ https://developer.android.com/design/ui/tv/samples/jet-fit
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="The Perfect Run The Perfect Run" />
|
tools:text="The Perfect Run The Perfect Run" />
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/result_next_airing_holder"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="start"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/result_episodes_text"
|
android:id="@+id/result_episodes_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginEnd="20dp"
|
|
||||||
android:textColor="?attr/textColor"
|
android:textColor="?attr/textColor"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible"
|
||||||
tools:text="8 Episodes" />
|
tools:text="8 Episodes" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/result_next_airing_holder"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/result_next_airing"
|
android:id="@+id/result_next_airing"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:gravity="start"
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="?attr/grayTextColor"
|
android:textColor="?attr/grayTextColor"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
tools:text="Episode 1022 will be released in" />
|
android:layout_marginEnd="5dp"
|
||||||
|
tools:text="Season 2 Episode 1022 will be released in" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/result_next_airing_time"
|
android:id="@+id/result_next_airing_time"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:textColor="?attr/textColor"
|
android:textColor="?attr/textColor"
|
||||||
android:textSize="17sp"
|
android:textSize="17sp"
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
<string name="app_dub_sub_episode_text_format" formatted="true">%1$s Ep %2$d</string>
|
<string name="app_dub_sub_episode_text_format" formatted="true">%1$s Ep %2$d</string>
|
||||||
<string name="cast_format" formatted="true">Cast: %s</string>
|
<string name="cast_format" formatted="true">Cast: %s</string>
|
||||||
<string name="next_episode_format" formatted="true">Episode %d will be released in</string>
|
<string name="next_episode_format" formatted="true">Episode %d will be released in</string>
|
||||||
|
<string name="next_season_episode_format" formatted="true">Season %1$d Episode %2$d will be released in</string>
|
||||||
<string name="next_episode_time_day_format" formatted="true">%1$dd %2$dh %3$dm</string>
|
<string name="next_episode_time_day_format" formatted="true">%1$dd %2$dh %3$dm</string>
|
||||||
<string name="next_episode_time_hour_format" formatted="true">%1$dh %2$dm</string>
|
<string name="next_episode_time_hour_format" formatted="true">%1$dh %2$dm</string>
|
||||||
<string name="next_episode_time_min_format" formatted="true">%dm</string>
|
<string name="next_episode_time_min_format" formatted="true">%dm</string>
|
||||||
|
|
Loading…
Reference in a new issue