[Android] Update mediagroup item to display thumb

Geoffrey Métais git at videolan.org
Mon Jun 20 15:59:46 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jun 20 14:53:27 2016 +0200| [6170c96fcb867cebcaf6646f63f97d23da5e4d88] | committer: Geoffrey Métais

Update mediagroup item to display thumb

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

 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 7b476f3..eeba467 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -469,6 +469,20 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
     public void setItemToUpdate(MediaWrapper item) {
         if (mVideoAdapter.contains(item))
             mHandler.sendMessage(mHandler.obtainMessage(MediaLibrary.UPDATE_ITEM, item));
+        else // Update group item when its first element is updated
+            for (int i = 0; i < mVideoAdapter.getItemCount(); ++i) {
+                if (mVideoAdapter.getItem(i) instanceof MediaGroup &&
+                        ((MediaGroup)mVideoAdapter.getItem(i)).getFirstMedia().equals(item)) {
+                    final int position = i;
+                    mHandler.post(new Runnable() {
+                        @Override
+                        public void run() {
+                            mVideoAdapter.notifyItemChanged(position);
+                        }
+                    });
+                    return;
+                }
+            }
     }
 
     public void setGroup(String prefix) {



More information about the Android mailing list