minor fixes
* fix episode count in MediaFragement * fix tmdb language tag * update media type detection to use the episode field as episodeNumber may be messinging from certain episodes of tv shows
This commit is contained in:
parent
01d026cc7f
commit
cf02bee7d4
@ -11,9 +11,9 @@ android {
|
||||
defaultConfig {
|
||||
applicationId "org.mosad.teapod"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 32
|
||||
versionCode 100990 //01.00.000
|
||||
versionName "1.1.0-beta1"
|
||||
targetSdkVersion 33
|
||||
versionCode 100991 //01.00.000
|
||||
versionName "1.1.0-beta2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
resValue "string", "build_time", buildTime()
|
||||
|
@ -245,11 +245,11 @@ data class SeriesItem(
|
||||
@SerialName("images") val images: Images,
|
||||
@SerialName("is_simulcast") val isSimulcast: Boolean,
|
||||
@SerialName("maturity_ratings") val maturityRatings: List<String>,
|
||||
@SerialName("audio_locales") val audioLocales: List<String>
|
||||
|
||||
@SerialName("audio_locales") val audioLocales: List<String>,
|
||||
@SerialName("episode_count") val episodeCount: Int
|
||||
)
|
||||
|
||||
val NoneSeriesItem = SeriesItem("", "", "", Images(emptyList(), emptyList()), false, emptyList(), emptyList())
|
||||
val NoneSeriesItem = SeriesItem("", "", "", Images(emptyList(), emptyList()), false, emptyList(), emptyList(), 0)
|
||||
val NoneSeries = Series(1, listOf(NoneSeriesItem))
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,6 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
|
||||
playerFinishedCallback()
|
||||
}
|
||||
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
binding = FragmentMediaBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
@ -91,6 +90,7 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
|
||||
|
||||
// load poster and backdrop
|
||||
Glide.with(requireContext()).load(posterUrl)
|
||||
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
||||
.into(binding.imagePoster)
|
||||
Glide.with(requireContext()).load(backdropUrl)
|
||||
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
||||
@ -147,14 +147,14 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
|
||||
// episodes count
|
||||
binding.textEpisodesOrRuntime.text = resources.getQuantityString(
|
||||
R.plurals.text_episodes_count,
|
||||
episodesCrunchy.total,
|
||||
episodesCrunchy.total
|
||||
seriesCrunchy.episodeCount,
|
||||
seriesCrunchy.episodeCount
|
||||
)
|
||||
}
|
||||
is TMDBMovie -> {
|
||||
val tmdbMovie = (tmdbResult as TMDBMovie?)
|
||||
val tmdbMovie = tmdbResult as TMDBMovie
|
||||
|
||||
if (tmdbMovie?.runtime != null) {
|
||||
if (tmdbMovie.runtime != null) {
|
||||
binding.textEpisodesOrRuntime.text = resources.getQuantityString(
|
||||
R.plurals.text_runtime,
|
||||
tmdbMovie.runtime,
|
||||
|
@ -76,9 +76,9 @@ class MediaFragmentViewModel(application: Application) : AndroidViewModel(applic
|
||||
currentEpisodesCrunchy.clear()
|
||||
currentEpisodesCrunchy.addAll(episodesCrunchy.data)
|
||||
|
||||
// set media type
|
||||
// set media type, for movies the episode field is empty
|
||||
mediaType = episodesCrunchy.data.firstOrNull()?.let {
|
||||
if (it.episodeNumber != null) MediaType.TVSHOW else MediaType.MOVIE
|
||||
if (it.episode.isNotEmpty()) MediaType.TVSHOW else MediaType.MOVIE
|
||||
} ?: MediaType.OTHER
|
||||
|
||||
// load playheads and tmdb in parallel
|
||||
|
@ -246,7 +246,7 @@ class PlayerViewModel(application: Application) : AndroidViewModel(application)
|
||||
}
|
||||
},
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
currentIntroMetadata = NoneDatalabIntro //Crunchyroll.datalabIntro(currentEpisode.id)
|
||||
currentIntroMetadata = Crunchyroll.datalabIntro(currentEpisode.id)
|
||||
}
|
||||
)
|
||||
Log.d(classTag, "streams: ${currentEpisode.streamsLink}")
|
||||
|
@ -67,7 +67,7 @@ class TMDBApiController {
|
||||
): T = coroutineScope {
|
||||
val path = "$apiUrl$endpoint"
|
||||
val params = concatenate(
|
||||
listOf("api_key" to apiKey, "language" to Preferences.preferredSubtitleLocale.language),
|
||||
listOf("api_key" to apiKey, "language" to Preferences.preferredSubtitleLocale.toLanguageTag()),
|
||||
parameters
|
||||
)
|
||||
|
||||
|
7
app/src/main/res/drawable/placeholder_image_2_3.xml
Normal file
7
app/src/main/res/drawable/placeholder_image_2_3.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="?colorSurfaceVariant"/>
|
||||
<size
|
||||
android:width="400px"
|
||||
android:height="600px"/>
|
||||
</shape>
|
@ -42,7 +42,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@string/media_poster_backdrop_desc"
|
||||
android:scaleType="fitCenter"
|
||||
tools:srcCompat="@drawable/placeholder_image" />
|
||||
tools:srcCompat="@android:color/darker_gray" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/image_poster"
|
||||
@ -53,7 +53,7 @@
|
||||
android:layout_marginBottom="7dp"
|
||||
android:scaleType="fitCenter"
|
||||
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
|
||||
tools:src="@drawable/ic_launcher_background" />
|
||||
tools:src="@drawable/placeholder_image_2_3" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user