[Android] Fix change detection of the lines of the main TV screen

Nicolas Pomepuy git at videolan.org
Wed Jul 10 11:23:40 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Jul 10 09:40:41 2019 +0200| [6901be922fcf2384df5503640200087cc2f7ffd3] | committer: Geoffrey Métais

Fix change detection of the lines of the main TV screen

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

 vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
index e3898a59c..81aa88fb4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvFragment.kt
@@ -191,7 +191,15 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
             }
 
         }
-        if (adapters.size != rowsAdapter.size()) rowsAdapter.setItems(adapters, TvUtil.listDiffCallback)
+        var needToRefresh = false
+        if (adapters.size != rowsAdapter.size()) needToRefresh = true else
+            adapters.withIndex().forEach {
+                if ((rowsAdapter.get(it.index) as ListRow).headerItem != it.value.headerItem) {
+                    needToRefresh = true
+                    return at forEach
+                }
+            }
+        if (needToRefresh) rowsAdapter.setItems(adapters, TvUtil.listDiffCallback)
     }
 
     override fun onStart() {



More information about the Android mailing list