Use ImageCardview in leanback samples.

Change-Id: I14606ff001cfd4ce244f32a8f1c973847ac1d0e3
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
index 00e93f9..ec547ec 100644
--- a/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/BrowseFragment.java
@@ -48,7 +48,7 @@
         mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
 
         for (int i = 0; i < NUM_ROWS; ++i) {
-            ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new StringPresenter());
+            ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter());
             listRowAdapter.add("Hello world");
             listRowAdapter.add("This is a test");
             HeaderItem header = new HeaderItem(i, "Row " + i, null);
diff --git a/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java b/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java
new file mode 100644
index 0000000..502c77a
--- /dev/null
+++ b/samples/SupportLeanbackDemos/src/com/example/android/leanback/CardPresenter.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.example.android.leanback;
+
+import android.support.v17.leanback.widget.ImageCardView;
+import android.support.v17.leanback.widget.Presenter;
+import android.util.Log;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class CardPresenter extends Presenter {
+    private static final String TAG = "CardPresenter";
+
+    public ViewHolder onCreateViewHolder(ViewGroup parent) {
+        Log.d(TAG, "onCreateViewHolder");
+        ImageCardView v = new ImageCardView(parent.getContext());
+        v.setFocusable(true);
+        v.setFocusableInTouchMode(true);
+        v.setMainImage(
+                parent.getContext().getResources().getDrawable(R.drawable.text_bg));
+        return new ViewHolder(v);
+    }
+
+    public void onBindViewHolder(ViewHolder viewHolder, Object item) {
+        Log.d(TAG, "onBindViewHolder for " + item.toString());
+        ((ImageCardView) viewHolder.view).setTitleText(item.toString());
+    }
+
+    public void onUnbindViewHolder(ViewHolder viewHolder) {
+        Log.d(TAG, "onUnbindViewHolder");
+    }
+}