[Android] Fix progressbar/seen visibility on TV UI

Sébastien Toque git at videolan.org
Fri Aug 6 04:14:26 UTC 2021


vlc-android | branch: master | Sébastien Toque <xilasz at gmail.com> | Thu Aug  5 16:05:47 2021 +0200| [5bc1352cd05648140cc0f4b260b2fb6f79b8fa0a] | committer: Nicolas Pomepuy

Fix progressbar/seen visibility on TV UI

> https://code.videolan.org/videolan/vlc-android/commit/5bc1352cd05648140cc0f4b260b2fb6f79b8fa0a
---

 .../src/main/java/org/videolan/television/ui/FileTvItemAdapter.kt | 8 ++++----
 .../java/org/videolan/television/ui/MediaScrapingTvItemAdapter.kt | 8 ++++----
 .../main/java/org/videolan/television/ui/MediaTvItemAdapter.kt    | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/application/television/src/main/java/org/videolan/television/ui/FileTvItemAdapter.kt b/application/television/src/main/java/org/videolan/television/ui/FileTvItemAdapter.kt
index e3162e57f..450dec69f 100644
--- a/application/television/src/main/java/org/videolan/television/ui/FileTvItemAdapter.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/FileTvItemAdapter.kt
@@ -198,8 +198,8 @@ class FileTvItemAdapter(private val eventsHandler: IEventsHandler<MediaLibraryIt
             if (showProtocol && item is MediaWrapper) binding.protocol = getProtocol(item)
             val cover = if (item is MediaWrapper) getMediaIconDrawable(binding.root.context, item.type, true) else defaultCover
             cover?.let { binding.cover = it }
-            if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
-            if (progress <= 0L) binding.progressBar.visibility = View.GONE
+            binding.mlItemSeen.visibility = if (seen == 0L) View.GONE else View.VISIBLE
+            binding.progressBar.visibility = if (progress <= 0L) View.GONE else View.VISIBLE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE
         }
 
@@ -279,8 +279,8 @@ class FileTvItemAdapter(private val eventsHandler: IEventsHandler<MediaLibraryIt
             if (showProtocol && item is MediaWrapper) binding.protocol = getProtocol(item)
             val cover = if (item is MediaWrapper) getMediaIconDrawable(binding.root.context, item.type, true) else defaultCover
             cover?.let { binding.cover = it }
-            if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
-            if (progress <= 0L) binding.progressBar.visibility = View.GONE
+            binding.mlItemSeen.visibility = if (seen == 0L) View.GONE else View.VISIBLE
+            binding.progressBar.visibility = if (progress <= 0L) View.GONE else View.VISIBLE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE
         }
 
diff --git a/application/television/src/main/java/org/videolan/television/ui/MediaScrapingTvItemAdapter.kt b/application/television/src/main/java/org/videolan/television/ui/MediaScrapingTvItemAdapter.kt
index d691b5c72..988201a3c 100644
--- a/application/television/src/main/java/org/videolan/television/ui/MediaScrapingTvItemAdapter.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/MediaScrapingTvItemAdapter.kt
@@ -263,8 +263,8 @@ class MediaScrapingTvItemAdapter(
             binding.seen = seen
             binding.description = description
             binding.scaleType = ImageView.ScaleType.CENTER_INSIDE
-            if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
-            if (progress <= 0L) binding.progressBar.visibility = View.GONE
+            binding.mlItemSeen.visibility = if (seen == 0L) View.GONE else View.VISIBLE
+            binding.progressBar.visibility = if (progress <= 0L) View.GONE else View.VISIBLE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE
         }
 
@@ -338,8 +338,8 @@ class MediaScrapingTvItemAdapter(
             binding.seen = seen
             binding.description = description
             binding.scaleType = ImageView.ScaleType.CENTER_INSIDE
-            if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
-            if (progress <= 0L) binding.progressBar.visibility = View.GONE
+            binding.mlItemSeen.visibility = if (seen == 0L) View.GONE else View.VISIBLE
+            binding.progressBar.visibility = if (progress <= 0L) View.GONE else View.VISIBLE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE
         }
 
diff --git a/application/television/src/main/java/org/videolan/television/ui/MediaTvItemAdapter.kt b/application/television/src/main/java/org/videolan/television/ui/MediaTvItemAdapter.kt
index 5bbadd307..b0052450a 100644
--- a/application/television/src/main/java/org/videolan/television/ui/MediaTvItemAdapter.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/MediaTvItemAdapter.kt
@@ -249,8 +249,8 @@ class MediaTvItemAdapter(type: Int, private val eventsHandler: IEventsHandler<Me
             binding.networkMediaOff.visibility = if(isNetwork() && !isPresent())  View.VISIBLE else View.GONE
             binding.networkOffOverlay.visibility = if(isNetwork() && !isPresent())  View.VISIBLE else View.GONE
             if (BuildConfig.DEBUG) Log.d(this::class.java.simpleName, "Card Setting network: ${!(item as? MediaWrapper)?.uri?.scheme.isSchemeFile()}, present: ${(item as? MediaWrapper)?.isPresent ?: true} for ${item?.title}")
-            if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
-            if (progress <= 0L) binding.progressBar.visibility = View.GONE
+            binding.mlItemSeen.visibility = if (seen == 0L) View.GONE else View.VISIBLE
+            binding.progressBar.visibility = if (progress <= 0L) View.GONE else View.VISIBLE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE
         }
 
@@ -330,8 +330,8 @@ class MediaTvItemAdapter(type: Int, private val eventsHandler: IEventsHandler<Me
             binding.networkMediaOff.visibility = if(isNetwork() && !isPresent())  View.VISIBLE else View.GONE
             binding.networkOffOverlay.visibility = if(isNetwork() && !isPresent())  View.VISIBLE else View.GONE
             if (BuildConfig.DEBUG) Log.d(this::class.java.simpleName, "Setting network: ${!(item as? MediaWrapper)?.uri?.scheme.isSchemeFile()}, present: ${(item as? MediaWrapper)?.isPresent ?: true} for ${item?.title}")
-            if (seen == 0L) binding.mlItemSeen.visibility = View.GONE
-            if (progress <= 0L) binding.progressBar.visibility = View.GONE
+            binding.mlItemSeen.visibility = if (seen == 0L) View.GONE else View.VISIBLE
+            binding.progressBar.visibility = if (progress <= 0L) View.GONE else View.VISIBLE
             binding.badgeTV.visibility = if (resolution.isBlank()) View.GONE else View.VISIBLE
         }
 



More information about the Android mailing list