[Android] Use new builder for HeaderItem

Geoffrey Métais git at videolan.org
Mon Apr 27 18:37:25 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Apr 27 17:53:26 2015 +0200| [7f7217a6647031d8d44c306c771876a332885b9a] | committer: Geoffrey Métais

Use new builder for HeaderItem

Leanback v22 requirement

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7f7217a6647031d8d44c306c771876a332885b9a
---

 vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java |    8 ++++----
 vlc-android/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java |    4 +---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 8b42167..77b9946 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -327,13 +327,13 @@ public class MainTvActivity extends Activity implements IVideoBrowser, OnItemVie
             mVideoIndex = new HashMap<String, Integer>();
             mVideoAdapter = new ArrayObjectAdapter(
                     new CardPresenter(mContext));
-            final HeaderItem videoHeader = new HeaderItem(HEADER_VIDEO, getString(R.string.video), null);
+            final HeaderItem videoHeader = new HeaderItem(HEADER_VIDEO, getString(R.string.video));
             // Empty item to launch grid activity
             mVideoAdapter.add(new CardPresenter.SimpleCard(0, "All videos", R.drawable.ic_video_collection_big));
             mRowsAdapter.add(new ListRow(videoHeader, mVideoAdapter));
             //Music sections
             mCategoriesAdapter = new ArrayObjectAdapter(new CardPresenter(mContext));
-            final HeaderItem musicHeader = new HeaderItem(HEADER_CATEGORIES, getString(R.string.audio), null);
+            final HeaderItem musicHeader = new HeaderItem(HEADER_CATEGORIES, getString(R.string.audio));
             mCategoriesAdapter.add(new CardPresenter.SimpleCard(MusicFragment.CATEGORY_ARTISTS, getString(R.string.artists), R.drawable.ic_artist_big));
             mCategoriesAdapter.add(new CardPresenter.SimpleCard(MusicFragment.CATEGORY_ALBUMS, getString(R.string.albums), R.drawable.ic_album_big));
             mCategoriesAdapter.add(new CardPresenter.SimpleCard(MusicFragment.CATEGORY_GENRES, getString(R.string.genres), R.drawable.ic_genre_big));
@@ -343,7 +343,7 @@ public class MainTvActivity extends Activity implements IVideoBrowser, OnItemVie
             if (AndroidDevices.hasLANConnection()) {
                 mNetworkAdapter = new ArrayObjectAdapter(new CardPresenter(mContext));
                 final ArrayList<MediaWrapper> favs = MediaDatabase.getInstance().getAllNetworkFav();
-                final HeaderItem networkHeader = new HeaderItem(HEADER_NETWORK, getString(R.string.network_browsing), null);
+                final HeaderItem networkHeader = new HeaderItem(HEADER_NETWORK, getString(R.string.network_browsing));
 
                 mNetworkAdapter.add(new CardPresenter.SimpleCard(0, getString(R.string.network_browsing), R.drawable.ic_menu_network_big));
                 if (!favs.isEmpty()) {
@@ -355,7 +355,7 @@ public class MainTvActivity extends Activity implements IVideoBrowser, OnItemVie
             }
 
             mOtherAdapter = new ArrayObjectAdapter(new CardPresenter(mContext));
-            final HeaderItem miscHeader = new HeaderItem(HEADER_MISC, getString(R.string.other), null);
+            final HeaderItem miscHeader = new HeaderItem(HEADER_MISC, getString(R.string.other));
 
             mOtherAdapter.add(new CardPresenter.SimpleCard(0, getString(R.string.preferences), R.drawable.ic_menu_preferences_big));
             mRowsAdapter.add(new ListRow(miscHeader, mOtherAdapter));
diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java
index bd32e98..0b3514e 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java
@@ -34,7 +34,6 @@ import android.support.v17.leanback.widget.HeaderItem;
 import android.support.v17.leanback.widget.ListRow;
 import android.support.v17.leanback.widget.ListRowPresenter;
 import android.support.v17.leanback.widget.ObjectAdapter;
-import android.support.v17.leanback.widget.OnItemClickedListener;
 import android.support.v17.leanback.widget.OnItemViewClickedListener;
 import android.support.v17.leanback.widget.Presenter;
 import android.support.v17.leanback.widget.Row;
@@ -95,8 +94,7 @@ public class SearchFragment extends android.support.v17.leanback.app.SearchFragm
         mHandler.post(new Runnable() {
             @Override
             public void run() {
-                HeaderItem header = new HeaderItem(0, getResources().getString(R.string.search_results),
-                        null);
+                HeaderItem header = new HeaderItem(0, getResources().getString(R.string.search_results));
                 mRowsAdapter.add(new ListRow(header, listRowAdapter));
             }
         });



More information about the Android mailing list