[Android] Fix video count on TV main activity

Nicolas Pomepuy git at videolan.org
Mon Dec 16 10:18:11 CET 2019


vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Dec 16 09:11:25 2019 +0100| [cb06aa9ae386f510ae3061ec1dbd1885d078b636] | committer: Geoffrey Métais

Fix video count on TV main activity

(cherry picked from commit 3a727247953e310efc62d943f33e2f799ea2ab56)

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

 vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt b/vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt
index 64e213746..860c2c083 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt
@@ -131,8 +131,9 @@ class MainTvModel(app: Application) : AndroidViewModel(app), AbstractMedialibrar
         context.getFromMl {
             getPagedVideos(AbstractMedialibrary.SORT_INSERTIONDATE, true, NUM_ITEMS_PREVIEW, 0)
         }.let {
+            val videoCount = withContext(Dispatchers.IO) { medialibrary.videoCount }
             (videos as MutableLiveData).value = mutableListOf<MediaLibraryItem>().apply {
-                add(DummyItem(HEADER_VIDEO, context.getString(R.string.videos_all), context.resources.getQuantityString(R.plurals.videos_quantity, it.size, it.size)))
+                add(DummyItem(HEADER_VIDEO, context.getString(R.string.videos_all), context.resources.getQuantityString(R.plurals.videos_quantity, videoCount, videoCount)))
                 addAll(it)
             }
         }



More information about the Android mailing list