[Android] TV: Remove lists refresh glitches

Geoffrey Métais git at videolan.org
Mon Dec 16 10:18:09 CET 2019


vlc-android | branch: 3.2.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 16 10:08:13 2019 +0100| [b5fffa3b2848a5118f2b9761bb7e6653bd0f77a1] | committer: Geoffrey Métais

TV: Remove lists refresh glitches

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

 vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt       | 7 +++++++
 .../src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt   | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt b/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt
index e66dc3697..dea49a08c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/FileTvItemAdapter.kt
@@ -66,6 +66,13 @@ class FileTvItemAdapter(private val type: Long, private val eventsHandler: IEven
         }
     }
 
+    override fun onBindViewHolder(holder: MediaTvItemAdapter.AbstractMediaItemViewHolder<MediaBrowserTvItemBinding>, position: Int, payloads: MutableList<Any>) {
+        if (payloads.isNullOrEmpty()) super.onBindViewHolder(holder, position, payloads)
+        else for (payload in payloads) {
+            holder.binding.description = if (payload is String) payload else getItem(position).description
+        }
+    }
+
     override fun onViewRecycled(holder: MediaTvItemAdapter.AbstractMediaItemViewHolder<MediaBrowserTvItemBinding>) {
         super.onViewRecycled(holder)
         holder.recycle()
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
index d136f71f5..34c6f7ee9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
@@ -138,7 +138,7 @@ class FileBrowserTvFragment : BaseBrowserTvFragment(), PathAdapterListener {
         (viewModel as BrowserModel).getDescriptionUpdate().observe(this, Observer { pair ->
             if (BuildConfig.DEBUG) Log.d(TAG, "Description update: ${pair.first} ${pair.second}")
             if (BuildConfig.DEBUG) Log.d(TAG, "header size (desc): ${viewModel.provider.headers.size()}")
-            if (pair != null) (adapter as RecyclerView.Adapter<*>).notifyItemChanged(pair.first)
+            if (pair != null) (adapter as RecyclerView.Adapter<*>).notifyItemChanged(pair.first, pair.second)
         })
 
         (viewModel as BrowserModel).loading.observe(this, Observer {



More information about the Android mailing list