[Android] Always sort audio lists

Geoffrey Métais git at videolan.org
Tue Jul 18 17:11:56 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jul 18 17:11:36 2017 +0200| [6291eb3efa7c2352f42e149c954f8f911ca0f558] | committer: Geoffrey Métais

Always sort audio lists

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

 .../org/videolan/vlc/gui/audio/AudioBrowserAdapter.java  | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 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 5077bf914..14a58ae27 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
@@ -334,7 +334,7 @@ public class AudioBrowserAdapter extends BaseQueuedAdapter<ArrayList<? extends M
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<? extends MediaLibraryItem> newListWithSections = prepareNewList(items, detectMoves);
+                final ArrayList<? extends MediaLibraryItem> newListWithSections = prepareNewList(items);
                 final DiffUtil.DiffResult result = DiffUtil.calculateDiff(new MediaItemDiffCallback(mDataList, newListWithSections), detectMoves);
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
@@ -349,16 +349,12 @@ public class AudioBrowserAdapter extends BaseQueuedAdapter<ArrayList<? extends M
         });
     }
 
-    private ArrayList<? extends MediaLibraryItem> prepareNewList(final ArrayList<? extends MediaLibraryItem> items, final boolean detectMoves) {
+    private ArrayList<? extends MediaLibraryItem> prepareNewList(final ArrayList<? extends MediaLibraryItem> items) {
         ArrayList<? extends MediaLibraryItem> newListWithSections;
-        if (detectMoves || mDataList.isEmpty()) {
-            ArrayList<? extends MediaLibraryItem> newList = removeSections(items);
-            Collections.sort(newList, sMediaComparator);
-            int realSortby = sMediaComparator.getRealSort(mType);
-            newListWithSections = generateList(newList, realSortby);
-        }
-        else
-            newListWithSections = new ArrayList<>(items);
+        ArrayList<? extends MediaLibraryItem> newList = removeSections(items);
+        Collections.sort(newList, sMediaComparator);
+        int realSortby = sMediaComparator.getRealSort(mType);
+        newListWithSections = generateList(newList, realSortby);
         return newListWithSections;
     }
 



More information about the Android mailing list