[Android] Improve text when no video is available

Nicolas Pomepuy git at videolan.org
Mon Apr 11 10:38:57 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr  5 13:30:31 2022 +0200| [0c5be949c10ebf9ef07a7a405bef5a70e2b4d301] | committer: Duncan McNamara

Improve text when no video is available

> https://code.videolan.org/videolan/vlc-android/commit/0c5be949c10ebf9ef07a7a405bef5a70e2b4d301
---

 application/resources/src/main/res/values/strings.xml                 | 1 +
 .../vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt    | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 6e4fd3ecf..606ede7a7 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -940,6 +940,7 @@
     <string name="touch_only_description">Switching to the mobile interface can only be done with a tactile screen or a mouse.\nPlease slide below to verify that this feature is safe to change.</string>
     <string name="no_web_browser">No web browser installed</string>
     <string name="no_web_browser_message">You can scan this on your smartphone.\nThe URL is %s</string>
+    <string name="no_video">No video available</string>
     <string name="fold_optimized">Optimized for your folding screen</string>
     <string name="fold_optimize">Optimize for folding screens</string>
     <string name="foldable">Foldable screen</string>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt
index 313398127..61635a496 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt
@@ -141,10 +141,10 @@ class VideoListAdapter(private var isSeenMediaMarkerVisible: Boolean
             }
             is VideoGroup -> holder.itemView.scope.launch {
                 val count = item.mediaCount()
-                holder.binding.setVariable(BR.time, if (count < 2) null else if (item.presentCount == item.mediaCount()) holder.itemView.context.resources.getQuantityString(R.plurals.videos_quantity, count, count) else item.getPresenceDescription())
+                holder.binding.setVariable(BR.time, if (count < 2) null else if (item.presentCount == item.mediaCount()) holder.itemView.context.resources.getQuantityString(R.plurals.videos_quantity, count, count) else if(item.presentCount == 0) holder.itemView.context.resources.getString(R.string.no_video) else item.getPresenceDescription())
                 holder.title.text = item.title
                 if (!isListMode) holder.binding.setVariable(BR.resolution, null)
-                val seen = if (item.presentSeen == item.presentCount) 1L else 0L
+                val seen = if (item.presentSeen == item.presentCount && item.presentCount != 0) 1L else 0L
                 holder.binding.setVariable(BR.seen, seen)
                 holder.binding.setVariable(BR.max, 0)
                 holder.binding.setVariable(BR.isPresent, item.presentCount > 0)



More information about the Android mailing list