[Android] Update deprecated setOnItemClickedListener method

Geoffrey Métais git at videolan.org
Tue Nov 25 17:23:55 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 25 17:22:39 2014 +0100| [3a9271595f96017caedd8e1d31c8e01cfbe874e1] | committer: Geoffrey Métais

Update deprecated setOnItemClickedListener method

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

 .../src/org/videolan/vlc/gui/tv/GridFragment.java  |   33 ++++++++++----------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/GridFragment.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/GridFragment.java
index fc46463..298af69 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/GridFragment.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/GridFragment.java
@@ -47,7 +47,11 @@ import android.os.Handler;
 import android.support.v17.leanback.app.VerticalGridFragment;
 import android.support.v17.leanback.widget.ArrayObjectAdapter;
 import android.support.v17.leanback.widget.OnItemClickedListener;
+import android.support.v17.leanback.widget.OnItemViewClickedListener;
+import android.support.v17.leanback.widget.OnItemViewSelectedListener;
+import android.support.v17.leanback.widget.Presenter;
 import android.support.v17.leanback.widget.Row;
+import android.support.v17.leanback.widget.RowPresenter;
 import android.support.v17.leanback.widget.VerticalGridPresenter;
 
 public class GridFragment extends VerticalGridFragment implements VideoBrowserInterface {
@@ -187,9 +191,10 @@ public class GridFragment extends VerticalGridFragment implements VideoBrowserIn
 		mAdapter.addAll(0, mMediaItemList);
 		setAdapter(mAdapter);
 
-		setOnItemClickedListener(new OnItemClickedListener() {
-			@Override
-			public void onItemClicked(Object item, Row row) {
+        setOnItemViewClickedListener(new OnItemViewClickedListener() {
+            @Override
+            public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+                                      RowPresenter.ViewHolder rowViewHolder, Row row) {
 				ListItem listItem = (ListItem) item;
 				Intent intent;
 				if (getString(R.string.artists).equals(mCategory)){
@@ -261,20 +266,14 @@ public class GridFragment extends VerticalGridFragment implements VideoBrowserIn
 
 		setAdapter(mAdapter);
 
-		/*setOnItemSelectedListener(new OnItemSelectedListener() {
-			@Override
-			public void onItemSelected(Object item, Row row) {
-				setTitle(((Media )item).getTitle());
-			}
-		});*/
-
-		setOnItemClickedListener(new OnItemClickedListener() {
-			@Override
-			public void onItemClicked(Object item, Row row) {
-				Media media = (Media) item;
-				TvUtil.openMedia(getActivity(), media, null);
-			}
-		});
+		setOnItemViewClickedListener(new OnItemViewClickedListener() {
+            @Override
+            public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
+                                      RowPresenter.ViewHolder rowViewHolder, Row row) {
+                Media media = (Media) item;
+                TvUtil.openMedia(getActivity(), media, null);
+            }
+        });
 	}
 
 	public void await() throws InterruptedException, BrokenBarrierException {



More information about the Android mailing list