[Android] Fix video count on TV main activity

Nicolas Pomepuy git at videolan.org
Mon Dec 16 09:27:37 CET 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Dec 16 09:11:25 2019 +0100| [3a727247953e310efc62d943f33e2f799ea2ab56] | committer: Nicolas Pomepuy

Fix video count on TV main activity

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

 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 e69bed5a4..5bbde272b 100644
--- a/vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt
+++ b/vlc-android/src/org/videolan/vlc/viewmodels/tv/MainTvModel.kt
@@ -139,11 +139,12 @@ class MainTvModel(app: Application) : AndroidViewModel(app), AbstractMedialibrar
     private fun updateVideos() = viewModelScope.launch {
         val allMovies = withContext(Dispatchers.IO) { mediaMetadataRepository.getMovieCount() }
         val allTvshows = withContext(Dispatchers.IO) { mediaMetadataRepository.getTvshowsCount() }
+        val videoNb = context.getFromMl { videoCount }
         context.getFromMl {
             getPagedVideos(AbstractMedialibrary.SORT_INSERTIONDATE, true, NUM_ITEMS_PREVIEW, 0)
         }.let {
             (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, videoNb, videoNb)))
                 if (allMovies > 0) {
                     add(DummyItem(HEADER_MOVIES, context.getString(R.string.header_movies), context.resources.getQuantityString(R.plurals.movies_quantity, allMovies, allMovies)))
                 }



More information about the Android mailing list