[Android] Audio: Always update headers

Geoffrey Métais git at videolan.org
Fri Feb 1 16:17:41 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb  1 15:15:13 2019 +0000| [f26d90b545f9c7ce099f07c2f487d749e63c4fa0] | committer: Geoffrey Métais

Audio: Always update headers

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java      | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
index aa25fb9b1..c9a4b9ee5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
@@ -31,6 +31,7 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import org.jetbrains.annotations.NotNull;
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.medialibrary.media.MediaLibraryItem;
 import org.videolan.tools.MultiSelectAdapter;
@@ -68,7 +69,6 @@ public class AudioBrowserAdapter extends PagedListAdapter<MediaLibraryItem, Audi
     private final int mType;
     private int mSort;
     private final BitmapDrawable mDefaultCover;
-    final LinkedList<ViewDataBinding> mHeaderBindings = new LinkedList<>();
 
     public AudioBrowserAdapter(int type, IEventsHandler eventsHandler, int sort) {
         super(DIFF_CALLBACK);
@@ -80,8 +80,6 @@ public class AudioBrowserAdapter extends PagedListAdapter<MediaLibraryItem, Audi
     }
 
     void setSort(int sort) {
-        for (ViewDataBinding binding : mHeaderBindings) binding.setVariable(BR.header, null);
-        mHeaderBindings.clear();
         mSort = sort;
     }
 
@@ -140,7 +138,6 @@ public class AudioBrowserAdapter extends PagedListAdapter<MediaLibraryItem, Audi
         if (mSort == -1) return;
         final MediaLibraryItem aboveItem = position > 0 ? getItem(position-1) : null;
         holder.binding.setVariable(BR.header, ModelsHelper.INSTANCE.getHeader(holder.itemView.getContext(), mSort, item, aboveItem));
-        mHeaderBindings.add(holder.binding);
     }
 
     public MultiSelectHelper<MediaLibraryItem> getMultiSelectHelper() {
@@ -280,11 +277,11 @@ public class AudioBrowserAdapter extends PagedListAdapter<MediaLibraryItem, Audi
                 @Override
                 public boolean areContentsTheSame(
                         @NonNull MediaLibraryItem oldMedia, @NonNull MediaLibraryItem newMedia) {
-                    return true;
+                    return false;
                 }
 
                 @Override
-                public Object getChangePayload(MediaLibraryItem oldItem, MediaLibraryItem newItem) {
+                public Object getChangePayload(@NotNull MediaLibraryItem oldItem, @NotNull MediaLibraryItem newItem) {
                     return UPDATE_PAYLOAD;
                 }
             };



More information about the Android mailing list