Commit 704754d4 authored by Geoffrey Métais's avatar Geoffrey Métais

'Last added' section for Android Auto

parent 5fc5b93c
......@@ -699,6 +699,7 @@
<string name="tv_settings_hint">Long press OK button to check/uncheck directories</string>
<string name="ml_external_storage_title">New external storage detected</string>
<string name="ml_external_storage_msg">Do you want VLC to add device %1$s to your medialibrary?</string>
<string name="last_added_media">last added</string>
<string-array name="chroma_formats" translatable="false">
<item>RGB 32-bit</item>
......@@ -57,19 +57,28 @@ public class BrowserProvider {
private static final String ID_GENRES = "ID_GENRES";
private static final String ID_PLAYLISTS = "ID_PLAYLISTS";
private static final String ID_HISTORY = "ID_HISTORY";
private static final String ID_LAST_ADDED = "ID_RECENT";
public static final String ALBUM_PREFIX = "album";
private static final String ARTIST_PREFIX = "artist";
private static final String GENRE_PREFIX = "genre";
public static final String PLAYLIST_PREFIX = "playlist";
public static final int MAX_HISTORY_SIZE = 50;
public static List<MediaBrowserCompat.MediaItem> browse(String parentId) {
ArrayList<MediaBrowserCompat.MediaItem> results = new ArrayList<>();
MediaLibraryItem[] list = null;
boolean limitSize = false;
Resources res = VLCApplication.getAppResources();
switch (parentId) {
case ID_ROOT:
//Last added
MediaDescriptionCompat.Builder item = new MediaDescriptionCompat.Builder()
results.add(new MediaBrowserCompat.MediaItem(, MediaBrowserCompat.MediaItem.FLAG_BROWSABLE));
item = new MediaDescriptionCompat.Builder()
......@@ -100,7 +109,12 @@ public class BrowserProvider {
results.add(new MediaBrowserCompat.MediaItem(, MediaBrowserCompat.MediaItem.FLAG_BROWSABLE));
return results;
limitSize = true;
list = VLCApplication.getMLInstance().getRecentAudio();
limitSize = true;
list = VLCApplication.getMLInstance().lastMediaPlayed();
......@@ -151,6 +165,8 @@ public class BrowserProvider {
libraryItem.getItemType() == MediaLibraryItem.TYPE_ALBUM ||
libraryItem.getItemType() == MediaLibraryItem.TYPE_PLAYLIST;
results.add(new MediaBrowserCompat.MediaItem(, playable ? MediaBrowserCompat.MediaItem.FLAG_PLAYABLE : MediaBrowserCompat.MediaItem.FLAG_BROWSABLE));
if (limitSize && results.size() == MAX_HISTORY_SIZE)
return results;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment