[Android] Show FAB for albums in Artist/Genre view

Geoffrey Métais git at videolan.org
Fri Dec 15 16:03:24 CET 2017


vlc-android | branch: chromecast | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec 14 13:50:25 2017 +0100| [90b354ab62889e91fe49a3e485a38055b249fd1a] | committer: Geoffrey Métais

Show FAB for albums in Artist/Genre view

Close #425

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

 .../videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java    | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

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 db4f7ff05..a045151b7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -379,14 +379,21 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
 
     @Override
     public void setFabPlayVisibility(boolean enable) {
-        super.setFabPlayVisibility(enable && mViewPager.getCurrentItem() == 1);
+        super.setFabPlayVisibility(enable);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public void onFabPlayClick(View view) {
         if (mService == null) return;
-        @SuppressWarnings("unchecked")
-        final List<MediaWrapper> list = (List<MediaWrapper>)(List<?>) mSongsAdapter.getMediaItems();
+        final List<MediaWrapper> list ;
+        if (mViewPager.getCurrentItem() == 0) {
+            list = new ArrayList<>();
+            for (MediaLibraryItem item : mAlbumsAdapter.getMediaItems())
+                list.addAll(Util.arrayToArrayList(item.getTracks()));
+        } else {
+            list = (List<MediaWrapper>) (List<?>) mSongsAdapter.getMediaItems();
+        }
         mService.load(list, 0);
     }
 }



More information about the Android mailing list