[Android] TV: Hide empty categories
Geoffrey Métais
git at videolan.org
Thu Nov 24 17:28:43 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 24 17:27:50 2016 +0100| [fcb52626377ba910f06e1e2bbb05ed9ce1cf5162] | committer: Geoffrey Métais
TV: Hide empty categories
> https://code.videolan.org/videolan/vlc-android/commit/fcb52626377ba910f06e1e2bbb05ed9ce1cf5162
---
vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java
index de2c92c..ad7db88 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MusicFragment.java
@@ -31,6 +31,7 @@ import android.support.v17.leanback.widget.OnItemViewClickedListener;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.Row;
import android.support.v17.leanback.widget.RowPresenter;
+import android.text.TextUtils;
import org.videolan.medialibrary.media.Artist;
import org.videolan.medialibrary.media.Genre;
@@ -41,6 +42,7 @@ import org.videolan.vlc.gui.tv.TvUtil;
import org.videolan.vlc.gui.tv.browser.interfaces.BrowserActivityInterface;
import java.util.Arrays;
+import java.util.List;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public class MusicFragment extends MediaLibBrowserFragment implements OnItemViewClickedListener {
@@ -166,7 +168,10 @@ public class MusicFragment extends MediaLibBrowserFragment implements OnItemView
}
protected void onProgressUpdate(MediaLibraryItem[]... datalist){
- mAdapter.addAll(0, Arrays.asList(((Object[]) datalist[0])));
+ List<Object> list = Arrays.asList(((Object[]) datalist[0]));
+ if (TextUtils.isEmpty(((MediaLibraryItem)list.get(0)).getTitle()))
+ list = list.subList(1, list.size());
+ mAdapter.addAll(0, list);
}
@Override
More information about the Android
mailing list