[Android] Fix audio 'play all' ctx menu option

Geoffrey Métais git at videolan.org
Wed Sep 26 17:48:05 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Sep 25 17:06:15 2018 +0200| [de24ae06d610cbb69a63fafbde1ce60d340e7428] | committer: Geoffrey Métais

Fix audio 'play all' ctx menu option

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

 .../src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java   | 11 -----------
 .../src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java      |  4 +---
 2 files changed, 1 insertion(+), 14 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 7e28d1a2f..16e351a15 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
@@ -155,17 +155,6 @@ public class AudioBrowserAdapter extends PagedListAdapter<MediaLibraryItem, Audi
         return currentList == null || currentList.isEmpty();
     }
 
-    int getListWithPosition(List<MediaLibraryItem> list, int position) {
-        int offset = 0, count = getItemCount();
-        for (int i = 0; i < count; ++i)
-            if (getItem(i).getItemType() == MediaLibraryItem.TYPE_DUMMY) {
-                if (i < position)
-                    ++offset;
-            } else
-                list.add(getItem(i));
-        return position-offset;
-    }
-
     @Override
     public long getItemId(int position) {
         return isPositionValid(position) ? getItem(position).getId() : -1;
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
index 294d0b792..bfcfd004f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
@@ -198,9 +198,7 @@ public abstract class BaseAudioBrowser extends MediaBrowserFragment<MLPagedModel
                 MediaUtils.INSTANCE.openArray(requireActivity(), media.getTracks(), 0);
                 break;
             case Constants.CTX_PLAY_ALL:
-                final List<MediaLibraryItem> mediaList = new ArrayList<>();
-                final int startPosition = adapter.getListWithPosition(mediaList, position);
-                MediaUtils.INSTANCE.openList(requireActivity(), (List<MediaWrapper>)(List<?>) mediaList, startPosition);
+                MediaUtils.INSTANCE.openArray(requireActivity(), (MediaWrapper[]) getViewModel().getAll(), position);
                 break;
             case Constants.CTX_INFORMATION:
                 showInfoDialog(media);



More information about the Android mailing list