[Android] [PATCH] Use interfaces as apparent type

Romain Vimont rom at rom1v.com
Thu Nov 9 17:12:06 CET 2017


Some specific implementations (like ArrayList and HashMap) were used
were the corresponding interfaces (List and Map) could fit.

As a consequence, it was not possible to use other implementations,
like that of Collections.EMPTY_LIST or Arrays.asList(…).

Therefore, use List or Map as apparent type where appropriate.

These changes only target the VLC app, not LibVLC.

Signed-off-by: Romain Vimont <rom at rom1v.com>
---
 .../src/org/videolan/vlc/PlaybackService.java      | 20 ++++---
 .../src/org/videolan/vlc/SortableAdapter.java      |  5 +-
 .../videolan/vlc/extensions/ExtensionsManager.java |  4 +-
 .../org/videolan/vlc/gui/BaseQueuedAdapter.java    | 19 +++----
 .../src/org/videolan/vlc/gui/DebugLogActivity.java |  2 +-
 .../src/org/videolan/vlc/gui/HistoryAdapter.java   |  2 +-
 .../videolan/vlc/gui/PlaybackServiceActivity.java  |  3 +-
 .../src/org/videolan/vlc/gui/PlaylistActivity.java |  8 +--
 .../org/videolan/vlc/gui/audio/AlbumAdapter.java   |  3 +-
 .../vlc/gui/audio/AudioAlbumsSongsFragment.java    |  6 +--
 .../vlc/gui/audio/AudioBrowserAdapter.java         | 34 ++++++------
 .../vlc/gui/audio/AudioBrowserFragment.java        | 12 ++---
 .../videolan/vlc/gui/audio/BaseAudioBrowser.java   |  4 +-
 .../videolan/vlc/gui/audio/PlaylistAdapter.java    |  8 ++-
 .../vlc/gui/browser/BaseBrowserAdapter.java        | 16 +++---
 .../vlc/gui/browser/BaseBrowserFragment.java       | 25 ++++-----
 .../videolan/vlc/gui/browser/ExtensionBrowser.java |  2 +-
 .../vlc/gui/browser/FileBrowserFragment.java       |  5 +-
 .../vlc/gui/browser/NetworkBrowserFragment.java    |  4 +-
 .../vlc/gui/browser/StorageBrowserAdapter.java     |  5 +-
 .../videolan/vlc/gui/dialogs/AdvOptionsDialog.java |  3 +-
 .../vlc/gui/dialogs/SelectChapterDialog.java       |  7 +--
 .../org/videolan/vlc/gui/helpers/AudioUtil.java    |  8 +--
 .../org/videolan/vlc/gui/tv/MainTvActivity.java    |  3 +-
 .../vlc/gui/tv/MediaItemDetailsFragment.java       |  4 +-
 .../gui/tv/audioplayer/AudioPlayerActivity.java    |  7 +--
 .../vlc/gui/tv/audioplayer/PlaylistAdapter.java    |  8 +--
 .../vlc/gui/tv/browser/BrowserGridFragment.java    |  5 +-
 .../vlc/gui/tv/browser/SortedBrowserFragment.java  |  5 +-
 .../videolan/vlc/gui/video/VideoGridFragment.java  | 12 ++---
 .../videolan/vlc/gui/video/VideoListAdapter.java   | 18 +++----
 .../vlc/gui/video/VideoPlayerActivity.java         | 13 ++---
 .../vlc/gui/video/benchmark/BenchActivity.java     |  8 +--
 .../org/videolan/vlc/media/BrowserProvider.java    |  4 +-
 .../src/org/videolan/vlc/media/MediaDatabase.java  | 26 ++++-----
 .../src/org/videolan/vlc/media/MediaGroup.java     | 10 ++--
 .../src/org/videolan/vlc/media/MediaUtils.java     |  4 +-
 .../org/videolan/vlc/media/MediaWrapperList.java   |  4 +-
 .../src/org/videolan/vlc/util/AndroidDevices.java  |  6 +--
 .../org/videolan/vlc/util/CustomDirectories.java   |  5 +-
 .../src/org/videolan/vlc/util/MediaItemFilter.java |  2 +-
 .../org/videolan/vlc/util/SubtitlesDownloader.java | 61 +++++++++++-----------
 vlc-android/src/org/videolan/vlc/util/Util.java    | 10 ++--
 .../src/org/videolan/vlc/util/VLCInstance.java     |  1 +
 .../src/org/videolan/vlc/util/VLCOptions.java      |  1 +
 45 files changed, 216 insertions(+), 206 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 7e1952db1..586b3d9e3 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -173,7 +173,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
     private boolean mSwitchingToVideo = false;
     private boolean mVideoBackground = false;
 
-    private final ArrayList<Callback> mCallbacks = new ArrayList<>();
+    private final List<Callback> mCallbacks = new ArrayList<>();
     private boolean mDetectHeadset = true;
     private PowerManager.WakeLock mWakeLock;
     private final AtomicBoolean mExpanding = new AtomicBoolean(false);
@@ -1887,7 +1887,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
      */
     @MainThread
     public void loadLocations(List<String> mediaPathList, int position) {
-        final ArrayList<MediaWrapper> mediaList = new ArrayList<>();
+        final List<MediaWrapper> mediaList = new ArrayList<>();
 
         for (int i = 0; i < mediaPathList.size(); i++) {
             String location = mediaPathList.get(i);
@@ -1979,9 +1979,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public void load(MediaWrapper media) {
-        final ArrayList<MediaWrapper> arrayList = new ArrayList<>();
-        arrayList.add(media);
-        load(arrayList, 0);
+        load(Collections.singletonList(media), 0);
     }
 
     /**
@@ -2045,7 +2043,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<Media.Slave> list = MediaDatabase.getInstance().getSlaves(mw.getLocation());
+                final List<Media.Slave> list = MediaDatabase.getInstance().getSlaves(mw.getLocation());
                 for (Media.Slave slave : list)
                     mMediaPlayer.addSlave(slave.type, Uri.parse(slave.uri), false);
             }
@@ -2220,7 +2218,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public void append(MediaWrapper media) {
-        final ArrayList<MediaWrapper> arrayList = new ArrayList<>();
+        final List<MediaWrapper> arrayList = new ArrayList<>();
         arrayList.add(media);
         append(arrayList);
     }
@@ -2253,7 +2251,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public void insertNext(MediaWrapper media) {
-        final ArrayList<MediaWrapper> arrayList = new ArrayList<>();
+        final List<MediaWrapper> arrayList = new ArrayList<>();
         arrayList.add(media);
         insertNext(arrayList);
     }
@@ -2290,8 +2288,8 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
     }
 
     @MainThread
-    public ArrayList<MediaWrapper> getMedias() {
-        final ArrayList<MediaWrapper> ml = new ArrayList<>();
+    public List<MediaWrapper> getMedias() {
+        final List<MediaWrapper> ml = new ArrayList<>();
         for (int i = 0; i < mMediaList.size(); i++) {
             ml.add(mMediaList.getMedia(i));
         }
@@ -2300,7 +2298,7 @@ public class PlaybackService extends MediaBrowserServiceCompat implements IVLCVo
 
     @MainThread
     public List<String> getMediaLocations() {
-        final ArrayList<String> medias = new ArrayList<>();
+        final List<String> medias = new ArrayList<>();
         for (int i = 0; i < mMediaList.size(); i++) {
             medias.add(mMediaList.getMRL(i));
         }
diff --git a/vlc-android/src/org/videolan/vlc/SortableAdapter.java b/vlc-android/src/org/videolan/vlc/SortableAdapter.java
index 8a7959213..aedb491c0 100644
--- a/vlc-android/src/org/videolan/vlc/SortableAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/SortableAdapter.java
@@ -9,6 +9,7 @@ import org.videolan.vlc.util.Util;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 
 public abstract class SortableAdapter<T extends MediaLibraryItem, VH extends RecyclerView.ViewHolder> extends BaseQueuedAdapter<T, VH> {
@@ -68,7 +69,7 @@ public abstract class SortableAdapter<T extends MediaLibraryItem, VH extends Rec
         return hasSortChanged();
     }
 
-    protected ArrayList<T> prepareList(ArrayList<T> list) {
+    protected List<T> prepareList(List<T> list) {
         if (needsSorting())
             Collections.sort(list, sMediaComparator);
         return list;
@@ -81,7 +82,7 @@ public abstract class SortableAdapter<T extends MediaLibraryItem, VH extends Rec
                 public void run() {
                     if (getSortBy() == MediaLibraryItemComparator.SORT_DEFAULT)
                         sMediaComparator.sortBy(getDefaultSort(), 1);
-                    final ArrayList<T> list = new ArrayList<>(peekLast());
+                    final List<T> list = new ArrayList<>(peekLast());
                     VLCApplication.runBackground(new Runnable() {
                         @Override
                         public void run() {
diff --git a/vlc-android/src/org/videolan/vlc/extensions/ExtensionsManager.java b/vlc-android/src/org/videolan/vlc/extensions/ExtensionsManager.java
index 91646d52f..4bd025d86 100644
--- a/vlc-android/src/org/videolan/vlc/extensions/ExtensionsManager.java
+++ b/vlc-android/src/org/videolan/vlc/extensions/ExtensionsManager.java
@@ -54,7 +54,7 @@ public class ExtensionsManager {
         List<ResolveInfo> resolveInfos = pm.queryIntentServices(
                 new Intent(ACTION_EXTENSION), PackageManager.GET_META_DATA);
 
-        ArrayList<ExtensionListing> extensions = new ArrayList<>();
+        List<ExtensionListing> extensions = new ArrayList<>();
 
         for (ResolveInfo resolveInfo : resolveInfos) {
             ExtensionListing extension = new ExtensionListing();
@@ -120,7 +120,7 @@ public class ExtensionsManager {
 
     private boolean deleteUnusedExtensionPreferences(List<ExtensionListing> list, SharedPreferences settings) {
         boolean extensionMissing = false;
-        ArrayList<String> extensionNames = new ArrayList<>();
+        List<String> extensionNames = new ArrayList<>();
         for (ExtensionListing extension : list)
             extensionNames.add(extension.componentName().getPackageName());
         for (Map.Entry<String, ?> entry : settings.getAll().entrySet())
diff --git a/vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java b/vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java
index 93e767a2b..a1f300aa0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/BaseQueuedAdapter.java
@@ -30,6 +30,7 @@ import org.videolan.vlc.util.MediaItemDiffCallback;
 
 import java.util.ArrayDeque;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.RejectedExecutionException;
@@ -37,8 +38,8 @@ import java.util.concurrent.RejectedExecutionException;
 public abstract class BaseQueuedAdapter <T extends MediaLibraryItem, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
     private final ExecutorService mUpdateExecutor = Executors.newSingleThreadExecutor();
 
-    protected volatile ArrayList<T> mDataset = new ArrayList<>();
-    private final ArrayDeque<ArrayList<T>> mPendingUpdates = new ArrayDeque<>();
+    protected volatile List<T> mDataset = new ArrayList<>();
+    private final ArrayDeque<List<T>> mPendingUpdates = new ArrayDeque<>();
 
     protected abstract void onUpdateFinished();
 
@@ -53,24 +54,24 @@ public abstract class BaseQueuedAdapter <T extends MediaLibraryItem, VH extends
     }
 
     @MainThread
-    public ArrayList<T> peekLast() {
+    public List<T> peekLast() {
         return mPendingUpdates.isEmpty() ? mDataset : mPendingUpdates.peekLast();
     }
 
     @MainThread
-    public void update(final ArrayList<T> items) {
+    public void update(final List<T> items) {
         mPendingUpdates.add(items);
         if (mPendingUpdates.size() == 1)
             internalUpdate(items);
     }
 
     @MainThread
-    private void internalUpdate(final ArrayList<T> newList) {
+    private void internalUpdate(final List<T> newList) {
         try {
             mUpdateExecutor.execute(new Runnable() {
                 @Override
                 public void run() {
-                    final ArrayList<T> finalList = prepareList(newList);
+                    final List<T> finalList = prepareList(newList);
                     final DiffUtil.DiffResult result = DiffUtil.calculateDiff(createCB(finalList), detectMoves());
                     VLCApplication.runOnMainThread(new Runnable() {
                         @Override
@@ -90,7 +91,7 @@ public abstract class BaseQueuedAdapter <T extends MediaLibraryItem, VH extends
         return false;
     }
 
-    protected ArrayList<T> prepareList(ArrayList<T> list) {
+    protected List<T> prepareList(List<T> list) {
         return list;
     }
 
@@ -100,7 +101,7 @@ public abstract class BaseQueuedAdapter <T extends MediaLibraryItem, VH extends
         if (mPendingUpdates.isEmpty())
             onUpdateFinished();
         else {
-            final ArrayList<T> lastList = mPendingUpdates.peekLast();
+            final List<T> lastList = mPendingUpdates.peekLast();
             if (!mPendingUpdates.isEmpty()) {
                 mPendingUpdates.clear();
                 mPendingUpdates.add(lastList);
@@ -109,7 +110,7 @@ public abstract class BaseQueuedAdapter <T extends MediaLibraryItem, VH extends
         }
     }
 
-    protected DiffUtil.Callback createCB(final ArrayList<T> items) {
+    protected DiffUtil.Callback createCB(final List<T> items) {
         return new MediaItemDiffCallback(mDataset, items);
     }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.java b/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.java
index 42bce65c6..3d1de467f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.java
@@ -44,7 +44,7 @@ public class DebugLogActivity extends Activity implements DebugLogService.Client
     private Button mClearButton = null;
     private Button mSaveButton = null;
     private ListView mLogView;
-    private ArrayList<String> mLogList = null;
+    private List<String> mLogList = null;
     private ArrayAdapter<String> mLogAdapter;
 
     @Override
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
index 7355c3ead..b7c7f3560 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
@@ -41,7 +41,7 @@ public class HistoryAdapter extends RecyclerView.Adapter<HistoryAdapter.ViewHold
     public final static String TAG = "VLC/HistoryAdapter";
 
     private IEventsHandler mEventsHandler;
-    private ArrayList<MediaWrapper> mMediaList = new ArrayList<>();
+    private List<MediaWrapper> mMediaList = new ArrayList<>();
     private LayoutInflater mLayoutInflater;
 
     public class ViewHolder extends SelectorViewHolder<HistoryItemBinding> {
diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java b/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java
index 07365e8a9..a8a23ec39 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java
@@ -29,6 +29,7 @@ import android.support.v4.app.FragmentActivity;
 import org.videolan.vlc.PlaybackService;
 
 import java.util.ArrayList;
+import java.util.List;
 
 public class PlaybackServiceActivity extends FragmentActivity implements PlaybackService.Client.Callback {
     final private Helper mHelper = new Helper(this, this);
@@ -61,7 +62,7 @@ public class PlaybackServiceActivity extends FragmentActivity implements Playbac
     }
 
     public static class Helper {
-        private ArrayList<PlaybackService.Client.Callback> mFragmentCallbacks = new ArrayList<PlaybackService.Client.Callback>();
+        private List<PlaybackService.Client.Callback> mFragmentCallbacks = new ArrayList<PlaybackService.Client.Callback>();
         final private PlaybackService.Client.Callback mActivityCallback;
         private PlaybackService.Client mClient;
         protected PlaybackService mService;
diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
index 8ec2dafe2..12da29ce1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaylistActivity.java
@@ -168,7 +168,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
 
     private void updateList() {
         if (mPlaylist != null) {
-            ArrayList<MediaLibraryItem> tracks = Util.arrayToMediaArrayList(mPlaylist.getTracks());
+            List<MediaLibraryItem> tracks = Util.arrayToMediaArrayList(mPlaylist.getTracks());
             mAdapter.addAll(tracks);
         }
     }
@@ -256,7 +256,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
         List<MediaLibraryItem> list = mAdapter.getSelection();
-        ArrayList<MediaWrapper> tracks = new ArrayList<>();
+        List<MediaWrapper> tracks = new ArrayList<>();
         for (MediaLibraryItem mediaItem : list)
             tracks.addAll(Arrays.asList(mediaItem.getTracks()));
 
@@ -299,7 +299,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
     @Override
     public void onDestroyActionMode(ActionMode mode) {
         mActionMode = null;
-        ArrayList<MediaLibraryItem> items = mAdapter.getAll();
+        List<MediaLibraryItem> items = mAdapter.getAll();
         if (items != null) {
             for (int i = 0; i < items.size(); ++i) {
                 if (items.get(i).hasStateFlags(MediaLibraryItem.FLAG_SELECTED)) {
@@ -424,7 +424,7 @@ public class PlaylistActivity extends AudioPlayerContainerActivity implements IE
     }
 
     private void removeFromPlaylist(final List<MediaWrapper> list){
-        final ArrayList<MediaLibraryItem> oldAdapter = new ArrayList<>(mAdapter.getAll());
+        final List<MediaLibraryItem> oldAdapter = new ArrayList<>(mAdapter.getAll());
         for (MediaLibraryItem mediaItem : list)
             mAdapter.remove(mediaItem);
         UiTools.snackerWithCancel(mBinding.getRoot(), getString(R.string.file_deleted), new Runnable() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AlbumAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AlbumAdapter.java
index 923a0fe1f..80a36ac3f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AlbumAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AlbumAdapter.java
@@ -41,11 +41,12 @@ import org.videolan.vlc.gui.helpers.MediaComparators;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.List;
 
 public class AlbumAdapter extends BaseAdapter {
 
     private Context mContext;
-    private ArrayList<MediaWrapper> mMediaList;
+    private List<MediaWrapper> mMediaList;
 
     private ContextPopupMenuListener mContextPopupMenuListener;
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index 0460d4cca..2436fc9fa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -259,7 +259,7 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
         }
 
         if (useAllItems) {
-            ArrayList<MediaLibraryItem> items = new ArrayList<>();
+            List<MediaLibraryItem> items = new ArrayList<>();
             startPosition = mSongsAdapter.getListWithPosition(items, position);
             medias = items.toArray(new MediaWrapper[items.size()]);
         } else {
@@ -289,14 +289,14 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<MediaLibraryItem> albums;
+                final List<MediaLibraryItem> albums;
                 if (mItem.getItemType() == MediaLibraryItem.TYPE_ARTIST) {
                     albums = Util.arrayToMediaArrayList(((Artist) mItem).getAlbums());
                 } else if (mItem.getItemType() == MediaLibraryItem.TYPE_GENRE)
                     albums = Util.arrayToMediaArrayList(((Genre) mItem).getAlbums());
                 else
                     return;
-                final ArrayList<MediaLibraryItem> songs = new ArrayList<>();
+                final List<MediaLibraryItem> songs = new ArrayList<>();
                 for (MediaLibraryItem album : albums) {
                     songs.addAll(Util.arrayToArrayList(album.getTracks()));
                 }
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 462a0f96d..838927517 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserAdapter.java
@@ -65,7 +65,7 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
 
     private boolean mMakeSections = true;
 
-    private ArrayList<MediaLibraryItem> mOriginalDataSet;
+    private List<MediaLibraryItem> mOriginalDataSet;
     private ItemFilter mFilter = new ItemFilter();
     private IEventsHandler mIEventsHandler;
     private int mSelectionCount = 0;
@@ -151,18 +151,18 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
         return position >= 0 || position < mDataset.size();
     }
 
-    public ArrayList<MediaLibraryItem> getAll() {
+    public List<MediaLibraryItem> getAll() {
         return mDataset;
     }
 
-    ArrayList<MediaLibraryItem> getMediaItems() {
-        ArrayList<MediaLibraryItem> list = new ArrayList<>();
+    List<MediaLibraryItem> getMediaItems() {
+        List<MediaLibraryItem> list = new ArrayList<>();
         for (MediaLibraryItem item : mDataset)
             if (!(item.getItemType() == MediaLibraryItem.TYPE_DUMMY)) list.add(item);
         return list;
     }
 
-    int getListWithPosition(ArrayList<MediaLibraryItem> list, int position) {
+    int getListWithPosition(List<MediaLibraryItem> list, int position) {
         int offset = 0, count = getItemCount();
         for (int i = 0; i < count; ++i)
             if (mDataset.get(i).getItemType() == MediaLibraryItem.TYPE_DUMMY) {
@@ -205,20 +205,20 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
         mOriginalDataSet = null;
     }
 
-    public void addAll(ArrayList<MediaLibraryItem> items) {
+    public void addAll(List<MediaLibraryItem> items) {
         mDataset = new ArrayList<>(items);
     }
 
-    private ArrayList<MediaLibraryItem> removeSections(ArrayList<MediaLibraryItem> items) {
-        ArrayList<MediaLibraryItem> newList = new ArrayList<>();
+    private List<MediaLibraryItem> removeSections(List<MediaLibraryItem> items) {
+        List<MediaLibraryItem> newList = new ArrayList<>();
         for (MediaLibraryItem item : items)
             if (item.getItemType() != MediaLibraryItem.TYPE_DUMMY)
                 newList.add(item);
         return newList;
     }
 
-    private ArrayList<MediaLibraryItem> generateSections(ArrayList<? extends MediaLibraryItem> items, int sortby) {
-        ArrayList<MediaLibraryItem> datalist = new ArrayList<>();
+    private List<MediaLibraryItem> generateSections(List<? extends MediaLibraryItem> items, int sortby) {
+        List<MediaLibraryItem> datalist = new ArrayList<>();
         switch(sortby) {
             case MediaLibraryItemComparator.SORT_BY_TITLE:
                 String currentLetter = null;
@@ -321,17 +321,17 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
     }
 
     public void remove(final MediaLibraryItem item) {
-        final ArrayList<MediaLibraryItem> referenceList = new ArrayList<>(peekLast());
+        final List<MediaLibraryItem> referenceList = new ArrayList<>(peekLast());
         if (referenceList.size() == 0) return;
-        final ArrayList<MediaLibraryItem> dataList = new ArrayList<>(referenceList);
+        final List<MediaLibraryItem> dataList = new ArrayList<>(referenceList);
         dataList.remove(item);
         update(dataList);
     }
 
 
     public void addItem(final int position, final MediaLibraryItem item) {
-        final ArrayList<MediaLibraryItem> referenceList = peekLast();
-        final ArrayList<MediaLibraryItem> dataList = new ArrayList<>(referenceList);
+        final List<MediaLibraryItem> referenceList = peekLast();
+        final List<MediaLibraryItem> dataList = new ArrayList<>(referenceList);
         dataList.add(position,item);
         update(dataList);
     }
@@ -349,14 +349,14 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
         mIEventsHandler.onUpdateFinished(AudioBrowserAdapter.this);
     }
 
-    protected ArrayList<MediaLibraryItem> prepareList(ArrayList<MediaLibraryItem> items) {
+    protected List<MediaLibraryItem> prepareList(List<MediaLibraryItem> items) {
         if (!isSortAllowed(getSortBy()))
             sMediaComparator.setSortDefault();
         if (mMakeSections) {
             if (sMediaComparator.sortBy == MediaLibraryItemComparator.SORT_DEFAULT) {
                 return generateSections(items, getDefaultSort());
             } else {
-                ArrayList<MediaLibraryItem> newList = removeSections(items);
+                List<MediaLibraryItem> newList = removeSections(items);
                 Collections.sort(newList, sMediaComparator);
                 return generateSections(newList, sMediaComparator.sortBy);
             }
@@ -490,7 +490,7 @@ public class AudioBrowserAdapter extends SortableAdapter<MediaLibraryItem, Audio
 
         @Override
         protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
-            update((ArrayList<MediaLibraryItem>) filterResults.values);
+            update((List<MediaLibraryItem>) filterResults.values);
         }
 
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 73673fef9..def949d9e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -306,7 +306,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         if (useAllItems) {
             if (mSongsAdapter.getItemCount() <= position)
                 return false;
-            final ArrayList<MediaLibraryItem> mediaList = new ArrayList<>();
+            final List<MediaLibraryItem> mediaList = new ArrayList<>();
             startPosition = mSongsAdapter.getListWithPosition(mediaList, position);
             medias = Arrays.copyOf(mediaList.toArray(), mediaList.size(), MediaWrapper[].class);
         } else {
@@ -582,7 +582,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<MediaLibraryItem> artists = Util.arrayToMediaArrayList(mMediaLibrary.getArtists());
+                final List<MediaLibraryItem> artists = Util.arrayToMediaArrayList(mMediaLibrary.getArtists());
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
                     public void run() {
@@ -597,7 +597,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<MediaLibraryItem> albums = Util.arrayToMediaArrayList(mMediaLibrary.getAlbums());
+                final List<MediaLibraryItem> albums = Util.arrayToMediaArrayList(mMediaLibrary.getAlbums());
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
                     public void run() {
@@ -612,7 +612,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<MediaLibraryItem> media = Util.arrayToMediaArrayList(mMediaLibrary.getAudio());
+                final List<MediaLibraryItem> media = Util.arrayToMediaArrayList(mMediaLibrary.getAudio());
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
                     public void run() {
@@ -627,7 +627,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<MediaLibraryItem> genres = Util.arrayToMediaArrayList(mMediaLibrary.getGenres());
+                final List<MediaLibraryItem> genres = Util.arrayToMediaArrayList(mMediaLibrary.getGenres());
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
                     public void run() {
@@ -642,7 +642,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
-                final ArrayList<MediaLibraryItem> playlists = Util.arrayToMediaArrayList(mMediaLibrary.getPlaylists());
+                final List<MediaLibraryItem> playlists = Util.arrayToMediaArrayList(mMediaLibrary.getPlaylists());
                 VLCApplication.runOnMainThread(new Runnable() {
                     @Override
                     public void run() {
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 af4618b59..f837b2eec 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.java
@@ -110,7 +110,7 @@ public abstract class BaseAudioBrowser extends SortableFragment<AudioBrowserAdap
         List<MediaLibraryItem> list = getCurrentAdapter().getSelection();
         stopActionMode();
         if (!list.isEmpty()) {
-            ArrayList<MediaWrapper> tracks = new ArrayList<>();
+            List<MediaWrapper> tracks = new ArrayList<>();
             for (MediaLibraryItem mediaItem : list)
                 tracks.addAll(Arrays.asList(mediaItem.getTracks()));
             switch (item.getItemId()) {
@@ -143,7 +143,7 @@ public abstract class BaseAudioBrowser extends SortableFragment<AudioBrowserAdap
     public void onDestroyActionMode(AudioBrowserAdapter adapter) {
         setFabPlayVisibility(true);
         mActionMode = null;
-        ArrayList<? extends MediaLibraryItem> items = adapter.getAll();
+        List<? extends MediaLibraryItem> items = adapter.getAll();
         if (items != null) {
             for (int i = 0; i < items.size(); ++i) {
                 if (items.get(i).hasStateFlags(MediaLibraryItem.FLAG_SELECTED)) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java
index 798bbb5a7..05d589bf6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/PlaylistAdapter.java
@@ -28,7 +28,6 @@ import android.databinding.DataBindingUtil;
 import android.os.Message;
 import android.support.annotation.MainThread;
 import android.support.v4.app.Fragment;
-import android.support.v7.util.DiffUtil;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -46,7 +45,6 @@ import org.videolan.vlc.gui.BaseQueuedAdapter;
 import org.videolan.vlc.gui.helpers.UiTools;
 import org.videolan.vlc.interfaces.SwipeDragHelperAdapter;
 import org.videolan.vlc.media.MediaUtils;
-import org.videolan.vlc.util.MediaItemDiffCallback;
 import org.videolan.vlc.util.WeakHandler;
 
 import java.util.ArrayList;
@@ -61,7 +59,7 @@ public class PlaylistAdapter extends BaseQueuedAdapter<MediaWrapper, PlaylistAda
     private PlaybackService mService = null;
     private IPlayer mAudioPlayer;
 
-    private ArrayList<MediaWrapper> mOriginalDataSet;
+    private List<MediaWrapper> mOriginalDataSet;
     private int mCurrentIndex = 0;
 
     public interface IPlayer {
@@ -264,7 +262,7 @@ public class PlaylistAdapter extends BaseQueuedAdapter<MediaWrapper, PlaylistAda
                 mOriginalDataSet = new ArrayList<>(mDataset);
             final String[] queryStrings = charSequence.toString().trim().toLowerCase().split(" ");
             FilterResults results = new FilterResults();
-            ArrayList<MediaWrapper> list = new ArrayList<>();
+            List<MediaWrapper> list = new ArrayList<>();
             String title, location, artist, album, albumArtist, genre;
             mediaLoop:
             for (MediaWrapper media : mOriginalDataSet) {
@@ -295,7 +293,7 @@ public class PlaylistAdapter extends BaseQueuedAdapter<MediaWrapper, PlaylistAda
 
         @Override
         protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
-            update((ArrayList<MediaWrapper>) filterResults.values);
+            update((List<MediaWrapper>) filterResults.values);
         }
     }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 3b98dbec1..17b97dd01 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -72,7 +72,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
     private static final BitmapDrawable IMAGE_QA_PODCASTS = new BitmapDrawable(VLCApplication.getAppResources(), BitmapFactory.decodeResource(VLCApplication.getAppResources(), R.drawable.ic_browser_podcasts_normal));
     private static final BitmapDrawable IMAGE_QA_DOWNLOAD = new BitmapDrawable(VLCApplication.getAppResources(), BitmapFactory.decodeResource(VLCApplication.getAppResources(), R.drawable.ic_browser_download_normal));
 
-    private ArrayList<MediaLibraryItem> mOriginalData = null;
+    private List<MediaLibraryItem> mOriginalData = null;
     protected final BaseBrowserFragment fragment;
     private int mTop = 0, mMediaCount = 0, mSelectionCount = 0;
     private ItemFilter mFilter = new ItemFilter();
@@ -242,7 +242,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
 
     void addItem(MediaLibraryItem item, boolean top, int positionTo) {
         int position;
-        ArrayList<MediaLibraryItem> list = new ArrayList<>(peekLast());
+        List<MediaLibraryItem> list = new ArrayList<>(peekLast());
         if (positionTo != -1)
             position = positionTo;
         else
@@ -267,7 +267,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
     void removeItem(MediaLibraryItem item) {
         if (item.getItemType() == TYPE_MEDIA && (((MediaWrapper) item).getType() == MediaWrapper.TYPE_VIDEO || ((MediaWrapper) item).getType() == MediaWrapper.TYPE_AUDIO))
             mMediaCount--;
-        ArrayList<MediaLibraryItem> list = new ArrayList<>(peekLast());
+        List<MediaLibraryItem> list = new ArrayList<>(peekLast());
         list.remove(item);
         update(list);
     }
@@ -285,7 +285,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
             removeItem(mediaItem);
     }
 
-    public ArrayList<MediaLibraryItem> getAll(){
+    public List<MediaLibraryItem> getAll() {
         return mDataset;
     }
 
@@ -336,8 +336,8 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
 
     protected void checkBoxAction(View v, String mrl){}
 
-    ArrayList<MediaWrapper> getSelection() {
-        ArrayList<MediaWrapper> selection = new ArrayList<>();
+    List<MediaWrapper> getSelection() {
+        List<MediaWrapper> selection = new ArrayList<>();
         for (MediaLibraryItem item : mDataset) {
             if (item.hasStateFlags(FLAG_SELECTED))
                 selection.add((MediaWrapper) item);
@@ -366,7 +366,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
     }
 
     @Override
-    protected ArrayList<MediaLibraryItem> prepareList(ArrayList<MediaLibraryItem> list) {
+    protected List<MediaLibraryItem> prepareList(List<MediaLibraryItem> list) {
         if (fragment.isSortEnabled() && needsSorting())
             Collections.sort(list, sMediaComparator);
         mMediaCount = 0;
@@ -402,7 +402,7 @@ public class BaseBrowserAdapter extends SortableAdapter<MediaLibraryItem, BaseBr
 
         @Override
         protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
-            update((ArrayList<MediaLibraryItem>) filterResults.values);
+            update((List<MediaLibraryItem>) filterResults.values);
         }
     }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index 2a1695b12..37f28a4c8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -81,6 +81,7 @@ import org.videolan.vlc.util.WeakHandler;
 
 import java.util.ArrayList;
 import java.util.LinkedList;
+import java.util.List;
 
 
 public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAdapter> implements IRefreshable, MediaBrowser.EventListener, SwipeRefreshLayout.OnRefreshListener, View.OnClickListener, Filterable, IEventsHandler {
@@ -93,7 +94,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     public static final String KEY_POSITION = "key_list";
 
     public volatile boolean refreshing = false;
-    private ArrayList<MediaLibraryItem> refreshList;
+    private List<MediaLibraryItem> refreshList;
 
     protected BrowserFragmentHandler mHandler;
     protected MediaBrowser mMediaBrowser;
@@ -108,7 +109,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     protected boolean goBack = false;
     private final boolean mShowHiddenFiles;
 
-    private SimpleArrayMap<MediaLibraryItem, ArrayList<MediaLibraryItem>> mFoldersContentLists;
+    private SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>> mFoldersContentLists;
     public int mCurrentParsedPosition = 0;
 
     protected abstract Fragment createFragment();
@@ -141,7 +142,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
             bundle = getArguments();
         if (bundle != null) {
             if (VLCApplication.hasData(KEY_CONTENT_LIST))
-                mFoldersContentLists = (SimpleArrayMap<MediaLibraryItem, ArrayList<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST);
+                mFoldersContentLists = (SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST);
             mCurrentMedia = bundle.getParcelable(KEY_MEDIA);
             if (mCurrentMedia != null)
                 mMrl = mCurrentMedia.getLocation();
@@ -197,11 +198,11 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
 
         VLCApplication.storeData(KEY_CONTENT_LIST+mMrl, mFoldersContentLists);
         @SuppressWarnings("unchecked")
-        final SimpleArrayMap<MediaLibraryItem, ArrayList<MediaLibraryItem>> content = (SimpleArrayMap<MediaLibraryItem, ArrayList<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST + mMrl);
+        final SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>> content = (SimpleArrayMap<MediaLibraryItem, List<MediaLibraryItem>>) VLCApplication.getData(KEY_CONTENT_LIST + mMrl);
         if (content != null)
             mFoldersContentLists = content;
         @SuppressWarnings("unchecked")
-        final ArrayList<MediaLibraryItem> mediaList = (ArrayList<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST + mMrl);
+        final List<MediaLibraryItem> mediaList = (List<MediaLibraryItem>) VLCApplication.getData(KEY_MEDIA_LIST + mMrl);
         if (!Util.isListEmpty(mediaList))
             mAdapter.update(mediaList);
         else
@@ -295,7 +296,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
         final Bundle args = new Bundle();
         VLCApplication.storeData(KEY_MEDIA_LIST+mMrl, mAdapter.getAll());
         VLCApplication.storeData(KEY_CONTENT_LIST+ mMrl, mFoldersContentLists);
-        final ArrayList<MediaLibraryItem> list = mFoldersContentLists.get(media);
+        final List<MediaLibraryItem> list = mFoldersContentLists.get(media);
         if (!Util.isListEmpty(list) && !(this instanceof StorageBrowserFragment))
             VLCApplication.storeData(KEY_MEDIA_LIST+ media.getLocation(), list);
         args.putParcelable(KEY_MEDIA, media);
@@ -590,7 +591,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
                 }
                 return true;
             case R.id.directory_view_play_folder:
-                ArrayList<MediaWrapper> newMediaList = new ArrayList<>();
+                List<MediaWrapper> newMediaList = new ArrayList<>();
                 for (MediaLibraryItem mediaItem : mFoldersContentLists.get(mAdapter.get(position))){
                     if (((MediaWrapper)mediaItem).getType() == MediaWrapper.TYPE_AUDIO || (AndroidUtil.isHoneycombOrLater && ((MediaWrapper)mediaItem).getType() == MediaWrapper.TYPE_VIDEO))
                         newMediaList.add((MediaWrapper)mediaItem);
@@ -645,7 +646,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
         MediaUtils.openList(getActivity(), mediaLocations, positionInPlaylist);
     }
 
-    ArrayList<MediaLibraryItem> currentMediaList = new ArrayList<>();
+    List<MediaLibraryItem> currentMediaList = new ArrayList<>();
     protected void parseSubDirectories() {
         synchronized (currentMediaList) {
             currentMediaList = new ArrayList<>(mAdapter.getAll());
@@ -686,8 +687,8 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
     }
 
     private MediaBrowser.EventListener mFoldersBrowserListener = new MediaBrowser.EventListener(){
-        ArrayList<MediaWrapper> directories = new ArrayList<>();
-        ArrayList<MediaWrapper> files = new ArrayList<>();
+        List<MediaWrapper> directories = new ArrayList<>();
+        List<MediaWrapper> files = new ArrayList<>();
 
         @Override
         public void onMediaAdded(int index, final Media media) {
@@ -819,7 +820,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
             return false;
         }
         boolean single = this instanceof FileBrowserFragment && count == 1;
-        final ArrayList<MediaWrapper> selection = single ? mAdapter.getSelection() : null;
+        final List<MediaWrapper> selection = single ? mAdapter.getSelection() : null;
         int type = !Util.isListEmpty(selection) ? selection.get(0).getType() : -1;
         menu.findItem(R.id.action_mode_file_info).setVisible(single && (type == MediaWrapper.TYPE_AUDIO || type == MediaWrapper.TYPE_VIDEO));
         menu.findItem(R.id.action_mode_file_append).setVisible(mService.hasMedia());
@@ -828,7 +829,7 @@ public abstract class BaseBrowserFragment extends SortableFragment<BaseBrowserAd
 
     @Override
     public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
-        ArrayList<MediaWrapper> list = mAdapter.getSelection();
+        List<MediaWrapper> list = mAdapter.getSelection();
         if (!list.isEmpty()) {
             switch (item.getItemId()) {
                 case R.id.action_mode_file_play:
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java b/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
index 4cc01903d..7937cdbb9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
@@ -209,7 +209,7 @@ public class ExtensionBrowser extends Fragment implements View.OnClickListener,
         switch (item.getItemId()) {
             case R.id.extension_item_view_play_all:
                 List<VLCExtensionItem> items = mAdapter.getAll();
-                ArrayList<MediaWrapper> medias = new ArrayList<>(items.size());
+                List<MediaWrapper> medias = new ArrayList<>(items.size());
                 for (VLCExtensionItem vlcItem : items) {
                     medias.add(Utils.mediawrapperFromExtension(vlcItem));
                 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
index 59f4464cc..c7c7b15ea 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/FileBrowserFragment.java
@@ -25,8 +25,6 @@ package org.videolan.vlc.gui.browser;
 
 import android.content.Context;
 import android.content.DialogInterface;
-import android.net.Uri;
-import android.os.Environment;
 import android.support.v4.app.Fragment;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.widget.AppCompatEditText;
@@ -52,6 +50,7 @@ import org.videolan.vlc.util.Strings;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.List;
 
 public class FileBrowserFragment extends BaseBrowserFragment {
 
@@ -90,7 +89,7 @@ public class FileBrowserFragment extends BaseBrowserFragment {
             public void run() {
                 final String storages[] = AndroidDevices.getMediaDirectories();
                 MediaWrapper directory;
-                final ArrayList<MediaLibraryItem> devices = new ArrayList<>(storages.length);
+                final List<MediaLibraryItem> devices = new ArrayList<>(storages.length);
                 devices.add(new DummyItem(getString(R.string.browser_storages)));
                 for (String mediaDirLocation : storages) {
                     if (!(new File(mediaDirLocation).exists()))
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
index 65d07111b..282b36239 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
@@ -196,13 +196,13 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Exter
             return;
         }
 
-        ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
+        List<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
         int newSize = favs.size();
 
         if (newSize == 0 && mFavorites == 0)
             return;
         if (!allowLAN()) {
-            ArrayList<MediaWrapper> toRemove = new ArrayList<>();
+            List<MediaWrapper> toRemove = new ArrayList<>();
             List<String> schemes = Arrays.asList("ftp", "sftp", "ftps", "http", "https");
             for (MediaWrapper mw : favs)
                 if (!schemes.contains(mw.getUri().getScheme()))
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
index 517b19e8c..463221ecf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserAdapter.java
@@ -36,11 +36,12 @@ import org.videolan.vlc.util.CustomDirectories;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 class StorageBrowserAdapter extends BaseBrowserAdapter {
 
-    private static ArrayList<String> mMediaDirsLocation;
-    private static ArrayList<String> mCustomDirsLocation;
+    private static List<String> mMediaDirsLocation;
+    private static List<String> mCustomDirsLocation;
 
     StorageBrowserAdapter(BaseBrowserFragment fragment) {
         super(fragment);
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
index 92c5ede6f..546265000 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/AdvOptionsDialog.java
@@ -63,6 +63,7 @@ import org.videolan.vlc.util.Strings;
 
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.List;
 
 public class AdvOptionsDialog extends DialogFragment implements View.OnClickListener, PlaybackService.Client.Callback, View.OnFocusChangeListener, DialogInterface.OnKeyListener {
 
@@ -593,7 +594,7 @@ public class AdvOptionsDialog extends DialogFragment implements View.OnClickList
 
     private class AdvOptionsAdapter extends RecyclerView.Adapter<AdvOptionsAdapter.ViewHolder> {
 
-        private final ArrayList<Option> mList = new ArrayList<>();
+        private final List<Option> mList = new ArrayList<>();
         private int mSelection = 0;
 
         AdvOptionsAdapter() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java b/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java
index 4dd002e8a..ac7a06c03 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/SelectChapterDialog.java
@@ -41,6 +41,7 @@ import org.videolan.vlc.gui.helpers.UiTools;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 public class SelectChapterDialog extends DialogFragment implements PlaybackService.Client.Callback {
@@ -79,7 +80,7 @@ public class SelectChapterDialog extends DialogFragment implements PlaybackServi
             return;
         }
 
-        ArrayList<Map<String, String>> chapterList = new ArrayList<Map<String, String>>();
+        List<Map<String, String>> chapterList = new ArrayList<Map<String, String>>();
 
         for (int i = 0; i < chaptersCount; i++) {
             String name;
@@ -130,8 +131,8 @@ public class SelectChapterDialog extends DialogFragment implements PlaybackServi
         mService = null;
     }
 
-    private HashMap<String, String> putData(String name, String time) {
-        HashMap<String, String> item = new HashMap<String, String>();
+    private Map<String, String> putData(String name, String time) {
+        Map<String, String> item = new HashMap<String, String>();
         item.put("name", name);
         item.put("time", time);
         return item;
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
index 200cfd5e7..18eb0ce91 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.java
@@ -58,9 +58,9 @@ import java.io.UnsupportedEncodingException;
 import java.math.BigInteger;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.concurrent.atomic.AtomicReference;
 
 public class AudioUtil {
@@ -405,7 +405,7 @@ public class AudioUtil {
         return cover;
     }
 
-    public static Bitmap getCover(Context context, ArrayList<MediaWrapper> list, int width, boolean fromMemCache) {
+    public static Bitmap getCover(Context context, List<MediaWrapper> list, int width, boolean fromMemCache) {
         Bitmap cover = null;
         LinkedList<String> testedAlbums = new LinkedList<String>();
         for (MediaWrapper media : list) {
@@ -424,11 +424,11 @@ public class AudioUtil {
         return cover;
     }
 
-    public static Bitmap getCoverFromMemCache(Context context, ArrayList<MediaWrapper> list, int width) {
+    public static Bitmap getCoverFromMemCache(Context context, List<MediaWrapper> list, int width) {
         return getCover(context, list, width, true);
     }
 
-    public static Bitmap getCover(Context context, ArrayList<MediaWrapper> list, int width) {
+    public static Bitmap getCover(Context context, List<MediaWrapper> list, int width) {
         return getCover(context, list, width, false);
     }
 }
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index b6b5f1b68..9f7a83a8d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -79,7 +79,6 @@ import org.videolan.vlc.util.AndroidDevices;
 import org.videolan.vlc.util.Permissions;
 import org.videolan.vlc.util.VLCInstance;
 
-import java.util.ArrayList;
 import java.util.List;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@@ -505,7 +504,7 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
 
         if (ExternalMonitor.isLan()) {
             try {
-                final ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
+                final List<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
                 mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_NETWORK, getString(R.string.network_browsing), R.drawable.ic_menu_network_big));
                 mBrowserAdapter.add(new CardPresenter.SimpleCard(HEADER_STREAM, getString(R.string.open_mrl), R.drawable.ic_menu_stream_big));
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java
index 9263ed467..948b7d4da 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MediaItemDetailsFragment.java
@@ -55,7 +55,7 @@ import org.videolan.vlc.media.MediaDatabase;
 import org.videolan.vlc.media.MediaUtils;
 import org.videolan.vlc.util.FileUtils;
 
-import java.util.ArrayList;
+import java.util.List;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 public class MediaItemDetailsFragment extends DetailsFragment implements PlaybackService.Client.Callback {
@@ -121,7 +121,7 @@ public class MediaItemDetailsFragment extends DetailsFragment implements Playbac
         mMediaWrapper = media;
         setTitle(media.getTitle());
 
-        final ArrayList<MediaWrapper> mediaList = (ArrayList<MediaWrapper>) VLCApplication.getData(SortedBrowserFragment.CURRENT_BROWSER_LIST);
+        final List<MediaWrapper> mediaList = (List<MediaWrapper>) VLCApplication.getData(SortedBrowserFragment.CURRENT_BROWSER_LIST);
         // Attach your media item details presenter to the row presenter:
         FullWidthDetailsOverviewRowPresenter rowPresenter = new FullWidthDetailsOverviewRowPresenter(new DetailsDescriptionPresenter());
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
index fd587ca63..ead4fc12c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
@@ -55,6 +55,7 @@ import org.videolan.vlc.util.AndroidDevices;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 public class AudioPlayerActivity extends BaseTvActivity implements PlaybackService.Client.Callback,
@@ -67,7 +68,7 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
     private TvAudioPlayerBinding mBinding;
     private PlaylistAdapter mAdapter;
     private LinearLayoutManager mLayoutManager;
-    private ArrayList<MediaWrapper> mMediaList;
+    private List<MediaWrapper> mMediaList;
 
     //PAD navigation
     private static final int JOYSTICK_INPUT_DELAY = 300;
@@ -106,7 +107,7 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
         super.onConnected(service);
 
         mService.addCallback(this);
-        ArrayList<MediaWrapper> medias = mService.getMedias();
+        List<MediaWrapper> medias = mService.getMedias();
         if (!mMediaList.isEmpty() && !mMediaList.equals(medias)) {
             mService.load(mMediaList, mCurrentlyPlaying);
         } else {
@@ -326,7 +327,7 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
         mShuffling = shuffle;
         mBinding.buttonShuffle.setImageResource(shuffle ? R.drawable.ic_shuffle_on :
                 R.drawable.ic_shuffle_w);
-        ArrayList<MediaWrapper> medias = mService.getMedias();
+        List<MediaWrapper> medias = mService.getMedias();
         if (shuffle)
             Collections.shuffle(medias);
         else
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java
index c44e52557..127c8381c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java
@@ -30,13 +30,13 @@ import org.videolan.medialibrary.media.MediaWrapper;
 import org.videolan.vlc.R;
 import org.videolan.vlc.media.MediaUtils;
 
-import java.util.ArrayList;
+import java.util.List;
 
 public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHolder> implements View.OnClickListener{
     public static final String TAG = "VLC/PlaylistAdapter";
 
     private AudioPlayerActivity mAudioPlayerActivity;
-    private ArrayList<MediaWrapper> mDataset;
+    private List<MediaWrapper> mDataset;
     private int mSelectedItem = -1;
 
     public static class ViewHolder extends RecyclerView.ViewHolder {
@@ -49,7 +49,7 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
         }
     }
 
-    public PlaylistAdapter(AudioPlayerActivity audioPlayerActivity, ArrayList<MediaWrapper> myDataset) {
+    public PlaylistAdapter(AudioPlayerActivity audioPlayerActivity, List<MediaWrapper> myDataset) {
         mDataset = myDataset;
         mAudioPlayerActivity = audioPlayerActivity;
     }
@@ -97,7 +97,7 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
         }
     }
 
-    public void updateList(ArrayList<MediaWrapper> list){
+    public void updateList(List<MediaWrapper> list){
         mDataset = list;
         notifyDataSetChanged();
     }
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
index 800ba60aa..bddc79256 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
@@ -51,13 +51,14 @@ import org.videolan.vlc.util.VLCInstance;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 public class BrowserGridFragment extends GridFragment implements MediaBrowser.EventListener, OnItemViewSelectedListener, OnItemViewClickedListener, DetailsFragment {
 
     private MediaBrowser mMediaBrowser;
     private Uri mUri;
-    ArrayList<MediaWrapper> mMediaList = null;
+    List<MediaWrapper> mMediaList = null;
     private MediaWrapper mItemSelected;
     private boolean mShowHiddenFiles = false;
 
@@ -131,7 +132,7 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
     }
 
     public void sortList(){
-        ArrayList<MediaWrapper> files = new ArrayList<MediaWrapper>(), dirs = new ArrayList<MediaWrapper>();
+        List<MediaWrapper> files = new ArrayList<MediaWrapper>(), dirs = new ArrayList<MediaWrapper>();
         for (Object item : mMediaList){
             if (item instanceof MediaWrapper) {
                 MediaWrapper media = (MediaWrapper) item;
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
index 4ddbe7431..49d336f60 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
@@ -61,6 +61,7 @@ import org.videolan.vlc.util.WeakHandler;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
@@ -83,7 +84,7 @@ public abstract class SortedBrowserFragment extends BrowseSupportFragment implem
     protected MediaWrapper mItemSelected;
     protected Map<String, ListItem> mMediaItemMap = new ArrayMap<>(), mTempMap;
     protected final SimpleArrayMap<String, Integer> mMediaIndex = new SimpleArrayMap<>();
-    ArrayList<MediaWrapper> mVideosList = new ArrayList<>();
+    List<MediaWrapper> mVideosList = new ArrayList<>();
     protected final BrowserHandler mHandler = new BrowserHandler(this);
     private BackgroundManager mBackgroundManager;
 
@@ -274,7 +275,7 @@ public abstract class SortedBrowserFragment extends BrowseSupportFragment implem
 
     public static class ListItem {
         String Letter;
-        public ArrayList<MediaWrapper> mediaList;
+        public List<MediaWrapper> mediaList;
 
         ListItem(String letter, MediaWrapper mediaWrapper) {
             mediaList = new ArrayList<>();
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 b78e48f6d..a54723443 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -147,7 +147,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
         if (mAdapter.isListMode())
             mGridView.addItemDecoration(mDividerItemDecoration);
         if (savedInstanceState != null) {
-            final ArrayList<MediaWrapper> list = (ArrayList<MediaWrapper>) VLCApplication.getData("list"+getTitle());
+            final List<MediaWrapper> list = (List<MediaWrapper>) VLCApplication.getData("list"+getTitle());
             if (!Util.isListEmpty(list))
                 mAdapter.addAll(list);
         }
@@ -266,7 +266,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
                 playAudio(media);
                 return true;
             case R.id.video_list_play_all:
-                ArrayList<MediaWrapper> playList = new ArrayList<>();
+                List<MediaWrapper> playList = new ArrayList<>();
                 MediaUtils.openList(getActivity(), playList, mAdapter.getListWithPosition(playList, position));
                 return true;
             case R.id.video_list_info:
@@ -339,7 +339,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
 
     @Override
     public void onFabPlayClick(View view) {
-        ArrayList<MediaWrapper> playList = new ArrayList<>();
+        List<MediaWrapper> playList = new ArrayList<>();
         MediaUtils.openList(getActivity(), playList, mAdapter.getListWithPosition(playList, 0));
     }
 
@@ -361,7 +361,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
             @Override
             public void run() {
                 final MediaWrapper[] itemList = mMediaLibrary.getVideos();
-                final ArrayList<MediaWrapper> displayList = new ArrayList<>();
+                final List<MediaWrapper> displayList = new ArrayList<>();
                 if (mGroup != null) {
                     for (MediaWrapper item : itemList) {
                         String title = item.getTitle().substring(item.getTitle().toLowerCase().startsWith("the") ? 4 : 0);
@@ -500,7 +500,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
     public void onDestroyActionMode(ActionMode mode) {
         mActionMode = null;
         setFabPlayVisibility(true);
-        final ArrayList<MediaWrapper> items = mAdapter.getAll();
+        final List<MediaWrapper> items = mAdapter.getAll();
         for (int i = 0; i < items.size(); ++i) {
             MediaWrapper mw = items.get(i);
             if (mw.hasStateFlags(MediaLibraryItem.FLAG_SELECTED)) {
@@ -553,7 +553,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
             media.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
             final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
             if (settings.getBoolean("force_play_all", false)) {
-                final ArrayList<MediaWrapper> playList = new ArrayList<>();
+                final List<MediaWrapper> playList = new ArrayList<>();
                 MediaUtils.openList(activity, playList, mAdapter.getListWithPosition(playList, position));
             } else {
                 playVideo(media, false);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 33acf9729..b5babf773 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -67,7 +67,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
 
     private boolean mListMode = false;
     private IEventsHandler mEventsHandler;
-    private ArrayList<MediaWrapper> mOriginalData = null;
+    private List<MediaWrapper> mOriginalData = null;
     private final ItemFilter mFilter = new ItemFilter();
     private int mSelectionCount = 0;
     private int mGridCardWidth = 0;
@@ -147,14 +147,14 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
 
     @MainThread
     public void add(MediaWrapper item) {
-        final ArrayList<MediaWrapper> list = new ArrayList<>(peekLast());
+        final List<MediaWrapper> list = new ArrayList<>(peekLast());
         list.add(item);
         update(list);
     }
 
     @MainThread
     public void remove(MediaWrapper item) {
-        final ArrayList<MediaWrapper> refList = new ArrayList<>(peekLast());
+        final List<MediaWrapper> refList = new ArrayList<>(peekLast());
         if (refList.remove(item))
             update(refList);
     }
@@ -169,7 +169,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
         return mDataset.indexOf(mw) != -1;
     }
 
-    public ArrayList<MediaWrapper> getAll() {
+    public List<MediaWrapper> getAll() {
         return mDataset;
     }
 
@@ -270,7 +270,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
         return super.getItemViewType(position);
     }
 
-    int getListWithPosition(ArrayList<MediaWrapper>  list, int position) {
+    int getListWithPosition(List<MediaWrapper>  list, int position) {
         MediaWrapper mw;
         int offset = 0;
         for (int i = 0; i < getItemCount(); ++i) {
@@ -353,7 +353,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
         @Override
         protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
             //noinspection unchecked
-            update((ArrayList<MediaWrapper>) filterResults.values);
+            update((List<MediaWrapper>) filterResults.values);
         }
     }
 
@@ -367,7 +367,7 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
     }
 
     @Override
-    protected DiffUtil.Callback createCB(final ArrayList<MediaWrapper> items) {
+    protected DiffUtil.Callback createCB(final List<MediaWrapper> items) {
         return new VideoItemDiffCallback(mDataset, items);
     }
 
@@ -378,8 +378,8 @@ public class VideoListAdapter extends SortableAdapter<MediaWrapper, VideoListAda
     }
 
     private class VideoItemDiffCallback extends DiffUtil.Callback {
-        ArrayList<MediaWrapper> oldList, newList;
-        VideoItemDiffCallback(ArrayList<MediaWrapper> oldList, ArrayList<MediaWrapper> newList) {
+        List<MediaWrapper> oldList, newList;
+        VideoItemDiffCallback(List<MediaWrapper> oldList, List<MediaWrapper> newList) {
             this.oldList = new ArrayList<>(oldList);
             this.newList = new ArrayList<>(newList);
         }
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 41bb9d49e..295155525 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -143,6 +143,7 @@ import java.io.ObjectOutputStream;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 import java.util.Locale;
 
 public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.Callback,
@@ -340,7 +341,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
      * It is possible to have multiple custom subs in one session
      * (just like desktop VLC allows you as well.)
      */
-    private volatile ArrayList<String> mSubtitleSelectedFiles = new ArrayList<>();
+    private volatile List<String> mSubtitleSelectedFiles = new ArrayList<>();
 
     /**
      * Flag to indicate whether the media should be paused once loaded
@@ -3324,18 +3325,18 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     }
 
     private SubtitlesGetTask mSubtitlesGetTask = null;
-    private class SubtitlesGetTask extends AsyncTask<String, Void, ArrayList<String>> {
+    private class SubtitlesGetTask extends AsyncTask<String, Void, List<String>> {
         @Override
-        protected ArrayList<String> doInBackground(String... strings) {
+        protected List<String> doInBackground(String... strings) {
             final String subtitleList_serialized = strings[0];
-            ArrayList<String> prefsList = new ArrayList<>();
+            List<String> prefsList = new ArrayList<>();
 
             if (subtitleList_serialized != null) {
                 final ByteArrayInputStream bis = new ByteArrayInputStream(subtitleList_serialized.getBytes());
                 ObjectInputStream ois = null;
                 try {
                     ois = new ObjectInputStream(bis);
-                    prefsList = (ArrayList<String>) ois.readObject();
+                    prefsList = (List<String>) ois.readObject();
                 } catch (InterruptedIOException ignored) {
                     return prefsList; /* Task is cancelled */
                 } catch (ClassNotFoundException | IOException ignored) {
@@ -3351,7 +3352,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         }
 
         @Override
-        protected void onPostExecute(ArrayList<String> prefsList) {
+        protected void onPostExecute(List<String> prefsList) {
             // Add any selected subtitle file from the file picker
             if (prefsList.size() > 0) {
                 for (String file : prefsList) {
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
index a4af0cf23..851a64791 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/benchmark/BenchActivity.java
@@ -47,7 +47,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
+import java.util.List;
 
 /**
  * BenchActivity is a class that overrides VideoPlayerActivity through ShallowVideoPlayer.
@@ -87,7 +87,7 @@ public class BenchActivity extends ShallowVideoPlayer {
     private MediaProjection mMediaProjection = null;
     private ImageReader mImageReader = null;
     private Handler mHandler = null;
-    private ArrayList<Long> mTimestamp;
+    private List<Long> mTimestamp;
     private boolean mIsScreenshot = false;
     private int mScreenshotCount = 0;
     private int mScreenshotNumber = 0;
@@ -145,8 +145,8 @@ public class BenchActivity extends ShallowVideoPlayer {
                 if (!mIsScreenshot) {
                     errorFinish("Missing screenshots timestamps");
                 }
-                if (intent.getSerializableExtra(TIMESTAMPS) instanceof ArrayList) {
-                    mTimestamp = (ArrayList<Long>) intent.getSerializableExtra(TIMESTAMPS);
+                if (intent.getSerializableExtra(TIMESTAMPS) instanceof List) {
+                    mTimestamp = (List<Long>) intent.getSerializableExtra(TIMESTAMPS);
                 } else {
                     errorFinish("Failed to get timestamps");
                 }
diff --git a/vlc-android/src/org/videolan/vlc/media/BrowserProvider.java b/vlc-android/src/org/videolan/vlc/media/BrowserProvider.java
index 5e4c9cd8a..ca5690640 100644
--- a/vlc-android/src/org/videolan/vlc/media/BrowserProvider.java
+++ b/vlc-android/src/org/videolan/vlc/media/BrowserProvider.java
@@ -83,12 +83,12 @@ public class BrowserProvider implements ExtensionManagerService.ExtensionManager
     // Extensions management
     private static ServiceConnection sExtensionServiceConnection = null;
     private static ExtensionManagerService sExtensionManagerService;
-    private static ArrayList<MediaBrowserCompat.MediaItem> extensionItems = new ArrayList<>();
+    private static List<MediaBrowserCompat.MediaItem> extensionItems = new ArrayList<>();
     private static Semaphore extensionLock = new Semaphore(0);
 
     @WorkerThread
     public static List<MediaBrowserCompat.MediaItem> browse(String parentId) {
-        ArrayList<MediaBrowserCompat.MediaItem> results = new ArrayList<>();
+        List<MediaBrowserCompat.MediaItem> results = new ArrayList<>();
         MediaLibraryItem[] list = null;
         boolean limitSize = false;
         Resources res = VLCApplication.getAppResources();
diff --git a/vlc-android/src/org/videolan/vlc/media/MediaDatabase.java b/vlc-android/src/org/videolan/vlc/media/MediaDatabase.java
index d711bf6b5..3df5d0b8c 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaDatabase.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaDatabase.java
@@ -464,7 +464,7 @@ public class MediaDatabase {
      * @return An array of all the playlist names
      */
     public synchronized String[] getPlaylists() {
-        ArrayList<String> playlists = new ArrayList<String>();
+        List<String> playlists = new ArrayList<String>();
         Cursor c = mDb.query(
                 PLAYLIST_TABLE_NAME,
                 new String[]{PLAYLIST_NAME},
@@ -760,9 +760,9 @@ public class MediaDatabase {
                 new String[]{query + "*"}, null, null, null, null);
     }
 
-    public synchronized ArrayList<String> searchMedia(String filter){
+    public synchronized List<String> searchMedia(String filter){
 
-        ArrayList<String> mediaList = new ArrayList<String>();
+        List<String> mediaList = new ArrayList<String>();
         Cursor cursor = queryMedia(filter);
         if (cursor != null) {
             if (cursor.moveToFirst()) {
@@ -1132,8 +1132,8 @@ public class MediaDatabase {
         mDb.replace(SEARCHHISTORY_TABLE_NAME, null, values);
     }
 
-    public synchronized ArrayList<String> getSearchhistory(int size) {
-        ArrayList<String> history = new ArrayList<String>();
+    public synchronized List<String> getSearchhistory(int size) {
+        List<String> history = new ArrayList<String>();
 
         Cursor cursor = mDb.query(SEARCHHISTORY_TABLE_NAME,
                 new String[]{SEARCHHISTORY_KEY},
@@ -1164,8 +1164,8 @@ public class MediaDatabase {
         mDb.replace(MRL_TABLE_NAME, null, values);
     }
 
-    public synchronized ArrayList<String> getMrlhistory() {
-        ArrayList<String> history = new ArrayList<>();
+    public synchronized List<String> getMrlhistory() {
+        List<String> history = new ArrayList<>();
 
         Cursor cursor = mDb.query(MRL_TABLE_NAME,
                 new String[] { MRL_URI },
@@ -1218,8 +1218,8 @@ public class MediaDatabase {
             return false;
     }
 
-    public synchronized ArrayList<MediaWrapper> getAllNetworkFav() {
-        ArrayList<MediaWrapper> favs = new ArrayList<MediaWrapper>();
+    public synchronized List<MediaWrapper> getAllNetworkFav() {
+        List<MediaWrapper> favs = new ArrayList<MediaWrapper>();
 
         MediaWrapper mw;
         Cursor cursor = mDb.query(NETWORK_FAV_TABLE_NAME,
@@ -1262,7 +1262,7 @@ public class MediaDatabase {
         mDb.replace(EXTERNAL_SUBTITLES_TABLE_NAME, null, values);
     }
 
-    public synchronized ArrayList<String> getSubtitles(String mediaName) {
+    public synchronized List<String> getSubtitles(String mediaName) {
         if (TextUtils.isEmpty(mediaName))
             return new ArrayList<>();
         Cursor cursor = mDb.query(EXTERNAL_SUBTITLES_TABLE_NAME,
@@ -1270,7 +1270,7 @@ public class MediaDatabase {
                 EXTERNAL_SUBTITLES_MEDIA_NAME + "=?",
                 new String[] { mediaName },
                 null, null, null);
-        ArrayList<String> list = new ArrayList<>(cursor.getCount());
+        List<String> list = new ArrayList<>(cursor.getCount());
         if (cursor != null) {
             while (cursor.moveToNext()) {
                 String url = cursor.getString(1);
@@ -1313,13 +1313,13 @@ public class MediaDatabase {
             saveSlave(mw.getLocation(), slave.type, slave.priority, slave.uri);
     }
 
-    public synchronized ArrayList<Media.Slave> getSlaves(String mrl) {
+    public synchronized List<Media.Slave> getSlaves(String mrl) {
         Cursor cursor = mDb.query(SLAVES_TABLE_NAME,
                 new String[] {SLAVES_MEDIA_PATH, SLAVES_TYPE, SLAVES_PRIORITY, SLAVES_URI },
                 SLAVES_MEDIA_PATH + "=?",
                 new String[] { mrl },
                 null, null, null);
-        ArrayList<Media.Slave> list = new ArrayList<>(cursor.getCount());
+        List<Media.Slave> list = new ArrayList<>(cursor.getCount());
         if (cursor != null) {
             while (cursor.moveToNext()) {
                 String uri = cursor.getString(3);
diff --git a/vlc-android/src/org/videolan/vlc/media/MediaGroup.java b/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
index 28644a86a..db64b5c03 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaGroup.java
@@ -34,7 +34,7 @@ public class MediaGroup extends MediaWrapper {
 
     public final static String TAG = "VLC/MediaGroup";
 
-    private ArrayList<MediaWrapper> mMedias;
+    private List<MediaWrapper> mMedias;
 
     public MediaGroup(MediaWrapper media) {
         super(media.getUri(),
@@ -75,7 +75,7 @@ public class MediaGroup extends MediaWrapper {
         return mMedias.get(0);
     }
 
-    public ArrayList<MediaWrapper> getAll() {
+    public List<MediaWrapper> getAll() {
         return mMedias;
     }
 
@@ -89,7 +89,7 @@ public class MediaGroup extends MediaWrapper {
     }
 
     public static List<MediaGroup> group(MediaWrapper[] mediaList) {
-        ArrayList<MediaGroup> groups = new ArrayList<>();
+        List<MediaGroup> groups = new ArrayList<>();
         for (MediaWrapper media : mediaList)
             if (media != null)
                 insertInto(groups, media);
@@ -97,14 +97,14 @@ public class MediaGroup extends MediaWrapper {
     }
 
     public static List<MediaGroup> group(List<MediaWrapper> mediaList) {
-        ArrayList<MediaGroup> groups = new ArrayList<>();
+        List<MediaGroup> groups = new ArrayList<>();
         for (MediaWrapper media : mediaList)
             if (media != null)
                 insertInto(groups, media);
         return groups;
     }
 
-    private static void insertInto(ArrayList<MediaGroup> groups, MediaWrapper media) {
+    private static void insertInto(List<MediaGroup> groups, MediaWrapper media) {
         SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
         int minGroupLengthValue = Integer.valueOf(preferences.getString("video_min_group_length", "6"));
         for (MediaGroup mediaGroup : groups) {
diff --git a/vlc-android/src/org/videolan/vlc/media/MediaUtils.java b/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
index 5c32ca4d0..8cdc489a6 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaUtils.java
@@ -38,13 +38,13 @@ public class MediaUtils {
     }
 
     public static void getSubs(Activity activity, MediaWrapper media, SubtitlesDownloader.Callback cb) {
-        ArrayList<MediaWrapper> mediaList = new ArrayList<>();
+        List<MediaWrapper> mediaList = new ArrayList<>();
         mediaList.add(media);
         getSubs(activity, mediaList, cb);
     }
 
     public static void getSubs(Activity activity, MediaWrapper media) {
-        ArrayList<MediaWrapper> mediaList = new ArrayList<>();
+        List<MediaWrapper> mediaList = new ArrayList<>();
         mediaList.add(media);
         getSubs(activity, mediaList);
     }
diff --git a/vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java b/vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java
index addf65c13..2223558c9 100644
--- a/vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java
+++ b/vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java
@@ -42,8 +42,8 @@ public class MediaWrapperList {
     private static final int EVENT_MOVED = 2;
 
     /* TODO: add locking */
-    private ArrayList<MediaWrapper> mInternalList;
-    private ArrayList<EventListener> mEventListenerList;
+    private List<MediaWrapper> mInternalList;
+    private List<EventListener> mEventListenerList;
     private int mVideoCount = 0;
 
     public MediaWrapperList() {
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index 9670fc479..e929e0949 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -118,9 +118,9 @@ public class AndroidDevices {
      * hasCombBar test if device has Combined Bar : only for tablet with Honeycomb or ICS
      */
 
-    public static ArrayList<String> getExternalStorageDirectories() {
+    public static List<String> getExternalStorageDirectories() {
         BufferedReader bufReader = null;
-        final ArrayList<String> list = new ArrayList<>();
+        final List<String> list = new ArrayList<>();
         try {
             bufReader = new BufferedReader(new FileReader("/proc/mounts"));
             String line;
@@ -167,7 +167,7 @@ public class AndroidDevices {
     }
 
     public static String[] getMediaDirectories() {
-        final ArrayList<String> list = new ArrayList<>();
+        final List<String> list = new ArrayList<>();
         list.add(EXTERNAL_PUBLIC_DIRECTORY);
         list.addAll(getExternalStorageDirectories());
         list.addAll(Arrays.asList(CustomDirectories.getCustomDirectories()));
diff --git a/vlc-android/src/org/videolan/vlc/util/CustomDirectories.java b/vlc-android/src/org/videolan/vlc/util/CustomDirectories.java
index 7947acc8c..1575f4fee 100644
--- a/vlc-android/src/org/videolan/vlc/util/CustomDirectories.java
+++ b/vlc-android/src/org/videolan/vlc/util/CustomDirectories.java
@@ -27,13 +27,14 @@ import org.videolan.vlc.VLCApplication;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 public class CustomDirectories {
 
     public static void addCustomDirectory(String path) {
         SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
 
-        ArrayList<String> dirs = new ArrayList<String>(
+        List<String> dirs = new ArrayList<String>(
                 Arrays.asList(CustomDirectories.getCustomDirectories()));
         dirs.add(path);
         StringBuilder builder = new StringBuilder();
@@ -51,7 +52,7 @@ public class CustomDirectories {
         SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
         if (!preferences.getString("custom_paths", "").contains(path))
             return;
-        ArrayList<String> dirs = new ArrayList<String>(
+        List<String> dirs = new ArrayList<String>(
                 Arrays.asList(preferences.getString("custom_paths", "").split(
                         ":")));
         dirs.remove(path);
diff --git a/vlc-android/src/org/videolan/vlc/util/MediaItemFilter.java b/vlc-android/src/org/videolan/vlc/util/MediaItemFilter.java
index 107b2ef00..4f636198b 100644
--- a/vlc-android/src/org/videolan/vlc/util/MediaItemFilter.java
+++ b/vlc-android/src/org/videolan/vlc/util/MediaItemFilter.java
@@ -20,7 +20,7 @@ public abstract class MediaItemFilter extends Filter {
     protected FilterResults performFiltering(CharSequence charSequence) {
         final String[] queryStrings = charSequence.toString().trim().toLowerCase().split(" ");
         FilterResults results = new FilterResults();
-        ArrayList<MediaLibraryItem> list = new ArrayList<>();
+        List<MediaLibraryItem> list = new ArrayList<>();
         for (MediaLibraryItem item : initData()) {
             for (String queryString : queryStrings) {
                 if (queryString.length() < 2)
diff --git a/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java b/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java
index ef8b97cc2..8dd87069b 100644
--- a/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java
+++ b/vlc-android/src/org/videolan/vlc/util/SubtitlesDownloader.java
@@ -61,6 +61,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.MissingResourceException;
 import java.util.Set;
@@ -82,7 +83,7 @@ public class SubtitlesDownloader {
     private static final String USER_AGENT = "VLSub 0.9";
     private static final File SUBTITLES_DIRECTORY = new File(VLCApplication.getAppContext().getExternalFilesDir(null), "subs");
 
-    private HashMap<String, Object> map = null;
+    private Map<String, Object> map = null;
     private XMLRPCClient mClient;
     private String mToken = null;
     private Activity mContext;
@@ -113,7 +114,7 @@ public class SubtitlesDownloader {
             Toast.makeText(mContext, R.string.subs_dl_lang_fail, Toast.LENGTH_SHORT).show();
             return;
         }
-        final ArrayList<String> finalLanguages = new ArrayList<>(languages);
+        final List<String> finalLanguages = new ArrayList<>(languages);
         VLCApplication.runBackground(new Runnable() {
             @Override
             public void run() {
@@ -134,7 +135,7 @@ public class SubtitlesDownloader {
         mHandler.sendEmptyMessage(DIALOG_SHOW);
         try {
             mClient = new XMLRPCClient(new URL(OpenSubtitlesAPIUrl));
-            map = ((HashMap<String, Object>) mClient.call("LogIn","","","fre",USER_AGENT));
+            map = ((Map<String, Object>) mClient.call("LogIn","","","fre",USER_AGENT));
             mToken = (String) map.get("token");
         } catch (XMLRPCException e) {
             if (BuildConfig.DEBUG) Log.e(TAG, "logIn", e);
@@ -159,7 +160,7 @@ public class SubtitlesDownloader {
         if (mToken == null)
             return;
         try {
-            map = ((HashMap<String, Object>)  mClient.call("LogOut", mToken));
+            map = ((Map<String, Object>)  mClient.call("LogOut", mToken));
         } catch (Throwable e){ //for various service outages
             Log.w("subtitles", "XMLRPCException", e);
         }
@@ -174,14 +175,14 @@ public class SubtitlesDownloader {
             //noinspection UnusedAssignment
             language = getCompliantLanguageID(language);
         final boolean single = mediaList.size() == 1;
-        final ArrayList<MediaWrapper> notFoundFiles = new ArrayList<>();
-        final HashMap<String, String> index = new HashMap<>();
-        final HashMap<String, ArrayList<String>> success = new HashMap<>();
-        final HashMap<String, ArrayList<String>> fails = new HashMap<>();
-        ArrayList<HashMap<String, String>> videoSearchList = prepareRequestList(mediaList, languages, index, true);
+        final List<MediaWrapper> notFoundFiles = new ArrayList<>();
+        final Map<String, String> index = new HashMap<>();
+        final Map<String, List<String>> success = new HashMap<>();
+        final Map<String, List<String>> fails = new HashMap<>();
+        List<Map<String, String>> videoSearchList = prepareRequestList(mediaList, languages, index, true);
         if (!videoSearchList.isEmpty()) {
             try {
-                map = (HashMap<String, Object>) mClient.call("SearchSubtitles", mToken, videoSearchList);
+                map = (Map<String, Object>) mClient.call("SearchSubtitles", mToken, videoSearchList);
             } catch (Throwable e) { //for various service outages
                 stop = true;
                 showSnackBar(R.string.service_unavailable);
@@ -195,10 +196,10 @@ public class SubtitlesDownloader {
                     for (Object map : subtitleMaps){
                         if (stop)
                             break;
-                        final String srtFormat = ((HashMap<String, String>) map).get("SubFormat");
-                        final String movieHash = ((HashMap<String, String>) map).get("MovieHash");
-                        final String subLanguageID = ((HashMap<String, String>) map).get("SubLanguageID");
-                        final String subDownloadLink = ((HashMap<String, String>) map).get("SubDownloadLink");
+                        final String srtFormat = ((Map<String, String>) map).get("SubFormat");
+                        final String movieHash = ((Map<String, String>) map).get("MovieHash");
+                        final String subLanguageID = ((Map<String, String>) map).get("SubLanguageID");
+                        final String subDownloadLink = ((Map<String, String>) map).get("SubDownloadLink");
                         final String fileUrl = index.get(movieHash);
                         if (fileUrl == null)
                             return;
@@ -210,7 +211,7 @@ public class SubtitlesDownloader {
                             if (success.containsKey(fileName))
                                 success.get(fileName).add(subLanguageID);
                             else {
-                                ArrayList<String> newLanguage = new ArrayList<>();
+                                List<String> newLanguage = new ArrayList<>();
                                 newLanguage.add(subLanguageID);
                                 success.put(fileName, newLanguage);
                             }
@@ -236,7 +237,7 @@ public class SubtitlesDownloader {
         if (!stop && !notFoundFiles.isEmpty() &&
                 !(videoSearchList = prepareRequestList(notFoundFiles, languages, index, false)).isEmpty()) {
             try {
-                map = (HashMap<String, Object>) mClient.call("SearchSubtitles", mToken,
+                map = (Map<String, Object>) mClient.call("SearchSubtitles", mToken,
                         videoSearchList);
             } catch (Throwable e) { //for various service outages
                 stop = true;
@@ -250,7 +251,7 @@ public class SubtitlesDownloader {
                     for (Object subtitleMap : subtitleMaps) {
                         if (stop)
                             break;
-                        final HashMap<String, Object> resultMap = (HashMap<String, Object>) subtitleMap;
+                        final Map<String, Object> resultMap = (Map<String, Object>) subtitleMap;
                         final String srtFormat = (String) resultMap.get("SubFormat");
                         final String queryNumber = (String) resultMap.get("QueryNumber");
                         final String subLanguageID = (String) resultMap.get("SubLanguageID");
@@ -265,7 +266,7 @@ public class SubtitlesDownloader {
                             if (success.containsKey(fileName))
                                 success.get(fileName).add(subLanguageID);
                             else {
-                                final ArrayList<String> newLanguage = new ArrayList<>();
+                                List<String> newLanguage = new ArrayList<>();
                                 newLanguage.add(subLanguageID);
                                 success.put(fileName, newLanguage);
                             }
@@ -283,12 +284,12 @@ public class SubtitlesDownloader {
                 continue;
             final String fileName = media.getUri().getLastPathSegment();
             if (!success.containsKey(fileName)){
-                final ArrayList<String> langs = new ArrayList<>();
+                final List<String> langs = new ArrayList<>();
                 for (String language : languages)
                     langs.add(getCompliantLanguageID(language));
                 fails.put(fileName, langs);
             } else {
-                final ArrayList<String> langs = new ArrayList<>();
+                final List<String> langs = new ArrayList<>();
                 for (String language : languages) {
                     final String langID = getCompliantLanguageID(language);
                     if (!success.get(fileName).contains(langID))
@@ -347,8 +348,8 @@ public class SubtitlesDownloader {
         }
     }
 
-    private ArrayList<HashMap<String, String>> prepareRequestList(List<MediaWrapper> mediaList, List<String> languages, HashMap<String, String> index, boolean firstPass) {
-        final ArrayList<HashMap<String, String>> videoSearchList = new ArrayList<>();
+    private List<Map<String, String>> prepareRequestList(List<MediaWrapper> mediaList, List<String> languages, Map<String, String> index, boolean firstPass) {
+        final List<Map<String, String>> videoSearchList = new ArrayList<>();
         for (MediaWrapper media : mediaList) {
             if (stop)
                 break;
@@ -372,7 +373,7 @@ public class SubtitlesDownloader {
                 if (stop)
                     break;
                 final String languageID = getCompliantLanguageID(item);
-                final HashMap<String, String> video = new HashMap<>();
+                final Map<String, String> video = new HashMap<>();
                 video.put("sublanguageid", languageID);
                 if (firstPass) {
                     index.put(hash, mediaUri.getPath());
@@ -421,18 +422,18 @@ public class SubtitlesDownloader {
         });
     }
 
-    private String buildSumup(HashMap<String, ArrayList<String>> success, HashMap<String, ArrayList<String>> fails, boolean single) {
+    private String buildSumup(Map<String, List<String>> success, Map<String, List<String>> fails, boolean single) {
         final StringBuilder textToDisplay = new StringBuilder();
         if (single) { // Text for the toast
             if (!success.isEmpty()) {
-                for (Entry<String, ArrayList<String>> entry : success.entrySet()) {
+                for (Entry<String, List<String>> entry : success.entrySet()) {
                     textToDisplay.append(VLCApplication.getAppResources().getString(R.string.snack_subloader_sub_found));
                     if (entry.getValue().size() > 1)
                         textToDisplay.append(" ").append(entry.getValue().toString()).append("\n");
                 }
             }
             if (!fails.isEmpty()) {
-                for (Entry<String, ArrayList<String>> entry : fails.entrySet()){
+                for (Entry<String, List<String>> entry : fails.entrySet()){
                     textToDisplay.append(VLCApplication.getAppResources().getString(R.string.snack_subloader_sub_not_found));
                     if (entry.getValue().size() > 1)
                         textToDisplay.append(" ").append(entry.getValue().toString()).append("\n");
@@ -442,8 +443,8 @@ public class SubtitlesDownloader {
             if (!success.isEmpty()){
                 textToDisplay.append(VLCApplication.getAppResources().getString(R.string.dialog_subloader_success)).append("\n");
 
-                for (Entry<String, ArrayList<String>> entry : success.entrySet()){
-                    final ArrayList<String> langs = entry.getValue();
+                for (Entry<String, List<String>> entry : success.entrySet()){
+                    final List<String> langs = entry.getValue();
                     final String filename = entry.getKey();
                     textToDisplay.append("\n- ").append(filename).append(" ").append(langs.toString());
                 }
@@ -455,8 +456,8 @@ public class SubtitlesDownloader {
             if (!fails.isEmpty()){
                 textToDisplay.append(VLCApplication.getAppResources().getString(R.string.dialog_subloader_fails)).append("\n");
 
-                for (Entry<String, ArrayList<String>> entry : fails.entrySet()){
-                    final ArrayList<String> langs = entry.getValue();
+                for (Entry<String, List<String>> entry : fails.entrySet()){
+                    final List<String> langs = entry.getValue();
                     final String filename = entry.getKey();
                     textToDisplay.append("\n- ").append(filename).append(" ").append(langs.toString());
                 }
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 11ce0cb13..79fe57988 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -133,20 +133,20 @@ public class Util {
         return false;
     }
 
-    public static <T extends MediaLibraryItem> ArrayList<MediaLibraryItem> arrayToMediaArrayList(T[] array) {
-        ArrayList<MediaLibraryItem> list = new ArrayList<>(array.length);
+    public static <T extends MediaLibraryItem> List<MediaLibraryItem> arrayToMediaArrayList(T[] array) {
+        List<MediaLibraryItem> list = new ArrayList<>(array.length);
         Collections.addAll(list, array);
         return list;
     }
 
-    public static <T> ArrayList<T> arrayToArrayList(T[] array) {
-        ArrayList<T> list = new ArrayList<>(array.length);
+    public static <T> List<T> arrayToArrayList(T[] array) {
+        List<T> list = new ArrayList<>(array.length);
         Collections.addAll(list, array);
         return list;
     }
 
     public static <T> void insertOrUdpate(List<T> dataset, T[] items) {
-        ArrayList<T> newItems = new ArrayList<>();
+        List<T> newItems = new ArrayList<>();
         outer:
         for (T newItem : items) {
             for (T oldItem : dataset) {
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
index fe51dd068..e22525356 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
@@ -58,6 +58,7 @@ public class VLCInstance {
                 throw new IllegalStateException("LibVLC initialisation failed: " + VLCUtil.getErrorMsg());
             }
 
+            // TODO change LibVLC signature to accept a List instead of an ArrayList
             sLibVLC = new LibVLC(context, VLCOptions.getLibOptions());
             VLCApplication.runBackground(sCopyLua);
         }
diff --git a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
index 2751fc1b5..3cb5e0d2f 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCOptions.java
@@ -51,6 +51,7 @@ public class VLCOptions {
     public static final int HW_ACCELERATION_DECODING = 1;
     public static final int HW_ACCELERATION_FULL = 2;
 
+    // TODO should return List<String>
     public static ArrayList<String> getLibOptions() {
         final Context context = VLCApplication.getAppContext();
         final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
-- 
2.11.0



More information about the Android mailing list