[Android] Fix vector drawable crash on TV interface on Android 4
Nicolas Pomepuy
git at videolan.org
Fri Aug 7 09:11:18 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Aug 7 06:35:56 2020 +0200| [a50bb7980c4aefe3819e5953d321bc1b04ee93b9] | committer: Nicolas Pomepuy
Fix vector drawable crash on TV interface on Android 4
> https://code.videolan.org/videolan/vlc-android/commit/a50bb7980c4aefe3819e5953d321bc1b04ee93b9
---
.../src/main/java/org/videolan/television/ui/CardPresenter.kt | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/CardPresenter.kt b/application/television/src/main/java/org/videolan/television/ui/CardPresenter.kt
index 973e8df0e..da4fd07b0 100644
--- a/application/television/src/main/java/org/videolan/television/ui/CardPresenter.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/CardPresenter.kt
@@ -59,6 +59,7 @@ class CardPresenter(private val context: Activity, private val isPoster: Boolean
private var sDefaultCardImage: Drawable? = VectorDrawableCompat.create(context.resources, R.drawable.ic_default_cone, context.theme)
private val imageDefaultWidth: Float by lazy { context.resources.getDimension(R.dimen.tv_grid_card_thumb_width) }
+ private val seenDrawable: Drawable? by lazy { VectorDrawableCompat.create(context.resources, R.drawable.ic_seen_tv_normal, context.theme) }
init {
mIsSeenMediaMarkerVisible = Settings.getInstance(context).getBoolean("media_seen", true)
@@ -146,7 +147,7 @@ class CardPresenter(private val context: Activity, private val isPoster: Boolean
if (mIsSeenMediaMarkerVisible
&& item.type == MediaWrapper.TYPE_VIDEO
&& item.seen > 0L)
- holder.cardView.badgeImage = ContextCompat.getDrawable(context, R.drawable.ic_seen_tv_normal)
+ holder.cardView.badgeImage = seenDrawable
holder.view.setOnLongClickListener { v ->
TvUtil.showMediaDetail(v.context, item)
true
@@ -199,13 +200,13 @@ class CardPresenter(private val context: Activity, private val isPoster: Boolean
if (mediaWrapper.time <= 0) {
if (mIsSeenMediaMarkerVisible && item.type == MediaWrapper.TYPE_VIDEO
&& item.seen > 0L)
- holder.cardView.badgeImage = ContextCompat.getDrawable(context, R.drawable.ic_seen_tv_normal)
+ holder.cardView.badgeImage = seenDrawable
}
}
UPDATE_SEEN -> {
val mw = item as MediaWrapper
if (mIsSeenMediaMarkerVisible && mw.type == MediaWrapper.TYPE_VIDEO && mw.seen > 0L)
- holder.cardView.badgeImage = ContextCompat.getDrawable(context, R.drawable.ic_seen_tv_normal)
+ holder.cardView.badgeImage = seenDrawable
}
}
}
More information about the Android
mailing list