don't show fully watched episodes in "Up next"

This commit is contained in:
Jannik 2022-03-04 20:42:21 +01:00
parent e8bf63a666
commit 4505f95309
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
4 changed files with 11 additions and 4 deletions

View File

@ -14,7 +14,7 @@ android {
minSdkVersion 23
targetSdkVersion 30
versionCode 4200 //00.04.200
versionName "1.0.0-alpha3"
versionName "1.0.0-alpha4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resValue "string", "build_time", buildTime()

View File

@ -106,7 +106,7 @@ data class ContinueWatchingItem(
// @SerialName("completion_status") val completionStatus: Boolean,
@SerialName("playhead") val playhead: Int,
// not present in watchlist -> continue_watching_item
// @SerialName("fully_watched") val fullyWatched: Boolean,
@SerialName("fully_watched") val fullyWatched: Boolean = false,
)
// EpisodePanel is used in ContinueWatchingItem

View File

@ -81,7 +81,8 @@ class HomeFragment : Fragment() {
// continue watching
val upNextJob = lifecycleScope.launch {
// TODO create EpisodeItemAdapter, which will start the playback of the selected episode immediately
adapterUpNext = MediaItemAdapter(Crunchyroll.upNextAccount().toItemMediaList())
adapterUpNext = MediaItemAdapter(Crunchyroll.upNextAccount().items
.filter { !it.fullyWatched }.toItemMediaList())
binding.recyclerNewEpisodes.adapter = adapterUpNext
}
asyncJobList.add(upNextJob)

View File

@ -23,7 +23,13 @@ fun Collection<Item>.toItemMediaList(): List<ItemMedia> {
@JvmName("toItemMediaListContinueWatchingItem")
fun Collection<ContinueWatchingItem>.toItemMediaList(): List<ItemMedia> {
return this.items.map {
return items.map {
ItemMedia(it.panel.episodeMetadata.seriesId, it.panel.title, it.panel.images.thumbnail[0][0].source)
}
}
fun List<ContinueWatchingItem>.toItemMediaList(): List<ItemMedia> {
return this.map {
ItemMedia(it.panel.episodeMetadata.seriesId, it.panel.title, it.panel.images.thumbnail[0][0].source)
}
}