Add default cover when posterUrl is null or empty (#423)

* add default cover image for when posterUrl is null or empty.

* show monke image on load when posterUrl is null or empty. Also, shows 'No Episodes found'on Tv Series when ep count is 0

* replace default cover image
This commit is contained in:
Jace 2022-01-11 20:53:08 +08:00 committed by GitHub
parent f7aa1ce06d
commit 296f58a0b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 5 deletions

View file

@ -1095,6 +1095,15 @@ class ResultFragment : Fragment() {
} }
result_info?.isVisible = api.providerType == ProviderType.MetaProvider result_info?.isVisible = api.providerType == ProviderType.MetaProvider
if (d.type.isEpisodeBased()) {
val ep = d as? TvSeriesLoadResponse
val epCount = ep?.episodes?.size ?: 1
if (epCount < 1) {
result_info?.text = getString(R.string.no_episodes_found)
result_info?.isVisible = true
}
}
currentHeaderName = d.name currentHeaderName = d.name
currentType = d.type currentType = d.type
@ -1158,11 +1167,15 @@ class ResultFragment : Fragment() {
result_meta_site?.text = d.apiName result_meta_site?.text = d.apiName
result_poster?.setImage(d.posterUrl) if (!d.posterUrl.isNullOrEmpty()) {
result_poster_blur?.setImageBlur(d.posterUrl, 10, 3) result_poster?.setImage(d.posterUrl)
result_poster_blur?.setImageBlur(d.posterUrl, 10, 3)
} else {
result_poster?.setImageResource(R.drawable.default_cover)
result_poster_blur?.setImageResource(R.drawable.default_cover)
}
result_poster_holder?.visibility = result_poster_holder?.visibility = VISIBLE
if (d.posterUrl.isNullOrBlank()) GONE else VISIBLE
result_play_movie?.text = result_play_movie?.text =
if (d.type == TvType.Torrent) getString(R.string.play_torrent_button) else getString( if (d.type == TvType.Torrent) getString(R.string.play_torrent_button) else getString(

View file

@ -48,7 +48,11 @@ object SearchResultBuilder {
cardText?.text = card.name cardText?.text = card.name
//imageTextProvider.text = card.apiName //imageTextProvider.text = card.apiName
cardView.setImage(card.posterUrl) if (!card.posterUrl.isNullOrEmpty()) {
cardView.setImage(card.posterUrl)
} else {
cardView.setImageResource(R.drawable.default_cover)
}
bg.setOnClickListener { bg.setOnClickListener {
clickCallback.invoke( clickCallback.invoke(

File diff suppressed because one or more lines are too long

View file

@ -223,6 +223,7 @@
<string name="episodes">Episodes</string> <string name="episodes">Episodes</string>
<string name="season_short">S</string> <string name="season_short">S</string>
<string name="episode_short">E</string> <string name="episode_short">E</string>
<string name="no_episodes_found">No Episodes found</string>
<string name="delete_file">Delete File</string> <string name="delete_file">Delete File</string>
<string name="delete">Delete</string> <string name="delete">Delete</string>