Bug 966022 - Use ItemType to define panel view items (r=margaret)
authorLucas Rocha <lucasr@mozilla.com>
Wed, 19 Feb 2014 17:37:00 +0000
changeset 169936 c2d4afef1eb1802dbd604bbab998158e96cbab9b
parent 169935 90be3775d43de4eab51967a0874affd8638bf6f6
child 169937 ea5b6c686ce2ba59c1dec3564f4774e9c8729c89
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmargaret
bugs966022
milestone30.0a1
Bug 966022 - Use ItemType to define panel view items (r=margaret)
mobile/android/base/home/PanelGridItemView.java
mobile/android/base/home/PanelGridView.java
mobile/android/base/home/PanelItemView.java
mobile/android/base/home/PanelListRow.java
mobile/android/base/home/PanelListView.java
mobile/android/base/home/PanelViewAdapter.java
mobile/android/base/moz.build
mobile/android/base/resources/layout/panel_article_item.xml
mobile/android/base/resources/layout/panel_grid_item_view.xml
mobile/android/base/resources/layout/panel_image_item.xml
mobile/android/base/resources/layout/panel_list_row.xml
mobile/android/base/resources/values-v11/themes.xml
mobile/android/base/resources/values/attrs.xml
mobile/android/base/resources/values/colors.xml
mobile/android/base/resources/values/styles.xml
mobile/android/base/resources/values/themes.xml
deleted file mode 100644
--- a/mobile/android/base/home/PanelGridItemView.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.home;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.mozilla.gecko.db.BrowserContract.HomeItems;
-import org.mozilla.gecko.favicons.Favicons;
-import org.mozilla.gecko.R;
-
-import com.squareup.picasso.Picasso;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.ImageView;
-import android.widget.ImageView.ScaleType;
-import android.widget.FrameLayout;
-import android.widget.TextView;
-
-public class PanelGridItemView extends FrameLayout {
-    private static final String LOGTAG = "GeckoPanelGridItemView";
-
-    private final ImageView mThumbnailView;
-
-    public PanelGridItemView(Context context) {
-        this(context, null);
-    }
-
-    public PanelGridItemView(Context context, AttributeSet attrs) {
-        this(context, attrs, R.attr.panelGridItemViewStyle);
-    }
-
-    public PanelGridItemView(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-
-        LayoutInflater.from(context).inflate(R.layout.panel_grid_item_view, this);
-        mThumbnailView = (ImageView) findViewById(R.id.image);
-    }
-
-    public void updateFromCursor(Cursor cursor) {
-        int imageIndex = cursor.getColumnIndexOrThrow(HomeItems.IMAGE_URL);
-        final String imageUrl = cursor.getString(imageIndex);
-
-        Picasso.with(getContext())
-               .load(imageUrl)
-               .into(mThumbnailView);
-    }
-}
--- a/mobile/android/base/home/PanelGridView.java
+++ b/mobile/android/base/home/PanelGridView.java
@@ -24,23 +24,23 @@ import android.widget.GridView;
 
 import java.util.EnumSet;
 
 public class PanelGridView extends GridView
                            implements DatasetBacked, PanelView {
     private static final String LOGTAG = "GeckoPanelGridView";
 
     private final ViewConfig mViewConfig;
-    private final PanelGridViewAdapter mAdapter;
+    private final PanelViewAdapter mAdapter;
     protected OnUrlOpenListener mUrlOpenListener;
 
     public PanelGridView(Context context, ViewConfig viewConfig) {
         super(context, null, R.attr.panelGridViewStyle);
         mViewConfig = viewConfig;
-        mAdapter = new PanelGridViewAdapter(context);
+        mAdapter = new PanelViewAdapter(context, viewConfig.getItemType());
         setAdapter(mAdapter);
         setOnItemClickListener(new PanelGridItemClickListener());
     }
 
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
         mUrlOpenListener = null;
@@ -51,34 +51,16 @@ public class PanelGridView extends GridV
         mAdapter.swapCursor(cursor);
     }
 
     @Override
     public void setOnUrlOpenListener(OnUrlOpenListener listener) {
         mUrlOpenListener = listener;
     }
 
-    private class PanelGridViewAdapter extends CursorAdapter {
-
-        public PanelGridViewAdapter(Context context) {
-            super(context, null, 0);
-        }
-
-        @Override
-        public void bindView(View bindView, Context context, Cursor cursor) {
-            final PanelGridItemView item = (PanelGridItemView) bindView;
-            item.updateFromCursor(cursor);
-        }
-
-        @Override
-        public View newView(Context context, Cursor cursor, ViewGroup parent) {
-            return new PanelGridItemView(context);
-        }
-    }
-
     private class PanelGridItemClickListener implements AdapterView.OnItemClickListener {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
             Cursor cursor = mAdapter.getCursor();
             if (cursor == null || !cursor.moveToPosition(position)) {
                 throw new IllegalStateException("Couldn't move cursor to position " + position);
             }
 
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/home/PanelItemView.java
@@ -0,0 +1,104 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.home;
+
+import org.mozilla.gecko.R;
+import org.mozilla.gecko.db.BrowserContract.HomeItems;
+import org.mozilla.gecko.home.HomeConfig.ItemType;
+
+import com.squareup.picasso.Picasso;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import java.lang.ref.WeakReference;
+
+class PanelItemView extends LinearLayout {
+    private final TextView mTitle;
+    private final TextView mDescription;
+    private final ImageView mImage;
+    private final LinearLayout mTitleDescContainer;
+
+    private PanelItemView(Context context, int layoutId) {
+        super(context);
+
+        LayoutInflater.from(context).inflate(layoutId, this);
+        mTitle = (TextView) findViewById(R.id.title);
+        mDescription = (TextView) findViewById(R.id.description);
+        mImage = (ImageView) findViewById(R.id.image);
+        mTitleDescContainer = (LinearLayout) findViewById(R.id.title_desc_container);
+    }
+
+    public void updateFromCursor(Cursor cursor) {
+        int titleIndex = cursor.getColumnIndexOrThrow(HomeItems.TITLE);
+        final String title = cursor.getString(titleIndex);
+
+        // Only show title if the item has one
+        final boolean hasTitle = !TextUtils.isEmpty(title);
+        mTitleDescContainer.setVisibility(hasTitle ? View.VISIBLE : View.GONE);
+        if (hasTitle) {
+            mTitle.setText(title);
+
+            int descriptionIndex = cursor.getColumnIndexOrThrow(HomeItems.DESCRIPTION);
+            final String description = cursor.getString(descriptionIndex);
+
+            final boolean hasDescription = !TextUtils.isEmpty(description);
+            mDescription.setVisibility(hasDescription ? View.VISIBLE : View.GONE);
+            if (hasDescription) {
+                mDescription.setText(description);
+            }
+        }
+
+        int imageIndex = cursor.getColumnIndexOrThrow(HomeItems.IMAGE_URL);
+        final String imageUrl = cursor.getString(imageIndex);
+
+        // Only try to load the image if the item has define image URL
+        final boolean hasImageUrl = !TextUtils.isEmpty(imageUrl);
+        mImage.setVisibility(hasImageUrl ? View.VISIBLE : View.GONE);
+
+        if (hasImageUrl) {
+            Picasso.with(getContext())
+                   .load(imageUrl)
+                   .error(R.drawable.favicon)
+                   .into(mImage);
+        }
+    }
+
+    private static class ArticleItemView extends PanelItemView {
+        private ArticleItemView(Context context) {
+            super(context, R.layout.panel_article_item);
+            setOrientation(LinearLayout.HORIZONTAL);
+        }
+    }
+
+    private static class ImageItemView extends PanelItemView {
+        private ImageItemView(Context context) {
+            super(context, R.layout.panel_image_item);
+            setOrientation(LinearLayout.VERTICAL);
+        }
+    }
+
+    public static PanelItemView create(Context context, ItemType itemType) {
+        switch(itemType) {
+            case ARTICLE:
+                return new ArticleItemView(context);
+
+            case IMAGE:
+                return new ImageItemView(context);
+
+            default:
+                throw new IllegalArgumentException("Could not create panel item view from " + itemType);
+        }
+    }
+}
deleted file mode 100644
--- a/mobile/android/base/home/PanelListRow.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.home;
-
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.db.BrowserContract.HomeItems;
-
-import com.squareup.picasso.Picasso;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.text.TextUtils;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.ImageView;
-
-public class PanelListRow extends TwoLineRow {
-
-    private final ImageView mIcon;
-
-    public PanelListRow(Context context) {
-        this(context, null);
-    }
-
-    public PanelListRow(Context context, AttributeSet attrs) {
-        super(context, attrs);
-
-        mIcon = (ImageView) findViewById(R.id.icon);
-    }
-
-    @Override
-    public void updateFromCursor(Cursor cursor) {
-        if (cursor == null) {
-            return;
-        }
-
-        // XXX: This will have to be updated once we come up with the
-        // final schema for Panel datasets (see bug 942288).
-
-        int titleIndex = cursor.getColumnIndexOrThrow(HomeItems.TITLE);
-        final String title = cursor.getString(titleIndex);
-        setTitle(title);
-
-        int descriptionIndex = cursor.getColumnIndexOrThrow(HomeItems.DESCRIPTION);
-        final String description = cursor.getString(descriptionIndex);
-        setDescription(description);
-
-        int imageIndex = cursor.getColumnIndexOrThrow(HomeItems.IMAGE_URL);
-        final String imageUrl = cursor.getString(imageIndex);
-
-        final boolean hasImageUrl = !TextUtils.isEmpty(imageUrl);
-        mIcon.setVisibility(hasImageUrl ? View.VISIBLE : View.GONE);
-
-        if (hasImageUrl) {
-            Picasso.with(getContext())
-                   .load(imageUrl)
-                   .error(R.drawable.favicon)
-                   .into(mIcon);
-        }
-    }
-}
--- a/mobile/android/base/home/PanelListView.java
+++ b/mobile/android/base/home/PanelListView.java
@@ -24,50 +24,33 @@ import android.widget.AdapterView;
 
 import java.util.EnumSet;
 
 public class PanelListView extends HomeListView
                            implements DatasetBacked, PanelView {
 
     private static final String LOGTAG = "GeckoPanelListView";
 
-    private final PanelListAdapter mAdapter;
+    private final PanelViewAdapter mAdapter;
     private final ViewConfig mViewConfig;
 
     public PanelListView(Context context, ViewConfig viewConfig) {
         super(context);
         mViewConfig = viewConfig;
-        mAdapter = new PanelListAdapter(context);
+        mAdapter = new PanelViewAdapter(context, viewConfig.getItemType());
         setAdapter(mAdapter);
         setOnItemClickListener(new PanelListItemClickListener());
     }
 
     @Override
     public void setDataset(Cursor cursor) {
         Log.d(LOGTAG, "Setting dataset: " + mViewConfig.getDatasetId());
         mAdapter.swapCursor(cursor);
     }
 
-    private class PanelListAdapter extends CursorAdapter {
-        public PanelListAdapter(Context context) {
-            super(context, null, 0);
-        }
-
-        @Override
-        public void bindView(View view, Context context, Cursor cursor) {
-            final PanelListRow row = (PanelListRow) view;
-            row.updateFromCursor(cursor);
-        }
-
-        @Override
-        public View newView(Context context, Cursor cursor, ViewGroup parent) {
-            return LayoutInflater.from(parent.getContext()).inflate(R.layout.panel_list_row, parent, false);
-        }
-    }
-
     private class PanelListItemClickListener implements AdapterView.OnItemClickListener {
         @Override
         public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
             Cursor cursor = mAdapter.getCursor();
             if (cursor == null || !cursor.moveToPosition(position)) {
                 throw new IllegalStateException("Couldn't move cursor to position " + position);
             }
 
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/home/PanelViewAdapter.java
@@ -0,0 +1,37 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko.home;
+
+import org.mozilla.gecko.R;
+import org.mozilla.gecko.home.HomeConfig.ItemType;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.support.v4.widget.CursorAdapter;
+import android.view.View;
+import android.view.ViewGroup;
+
+class PanelViewAdapter extends CursorAdapter {
+	private final Context mContext;
+	private final ItemType mItemType;
+
+    public PanelViewAdapter(Context context, ItemType itemType) {
+        super(context, null, 0);
+        mContext = context;
+        mItemType = itemType;
+    }
+
+    @Override
+    public void bindView(View view, Context context, Cursor cursor) {
+        final PanelItemView item = (PanelItemView) view;
+        item.updateFromCursor(cursor);
+    }
+
+    @Override
+    public View newView(Context context, Cursor cursor, ViewGroup parent) {
+        return PanelItemView.create(mContext, mItemType);
+    }
+}
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -228,22 +228,22 @@ gbjar.sources += [
     'home/HomeContextMenuInfo.java',
     'home/HomeFragment.java',
     'home/HomeListView.java',
     'home/HomePager.java',
     'home/HomePagerTabStrip.java',
     'home/LastTabsPanel.java',
     'home/MostRecentPanel.java',
     'home/MultiTypeCursorAdapter.java',
-    'home/PanelGridItemView.java',
     'home/PanelGridView.java',
+    'home/PanelItemView.java',
     'home/PanelLayout.java',
-    'home/PanelListRow.java',
     'home/PanelListView.java',
     'home/PanelManager.java',
+    'home/PanelViewAdapter.java',
     'home/PinSiteDialog.java',
     'home/ReadingListPanel.java',
     'home/SearchEngine.java',
     'home/SearchEngineRow.java',
     'home/SearchLoader.java',
     'home/SimpleCursorLoader.java',
     'home/SuggestClient.java',
     'home/TabMenuStrip.java',
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/panel_article_item.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <ImageView android:id="@+id/image"
+               android:layout_width="54dp"
+               android:layout_height="44dp"
+               android:layout_marginTop="10dip"
+               android:layout_marginLeft="10dip"
+               android:scaleType="centerCrop"/>
+
+    <LinearLayout android:id="@+id/title_desc_container"
+                  android:layout_width="fill_parent"
+                  android:layout_height="wrap_content"
+                  android:paddingTop="5dip"
+                  android:paddingBottom="5dip"
+                  android:paddingLeft="10dip"
+                  android:paddingRight="10dip"
+                  android:minHeight="@dimen/page_row_height"
+                  android:orientation="vertical">
+
+        <TextView android:id="@+id/title"
+                  style="@style/Widget.PanelItemView.Title"
+                  android:layout_width="fill_parent"
+                  android:layout_height="0dp"
+                  android:layout_weight="1"
+                  android:gravity="center_vertical"/>
+
+        <TextView android:id="@+id/description"
+                  style="@style/Widget.PanelItemView.Description"
+                  android:layout_width="fill_parent"
+                  android:layout_height="0dp"
+                  android:layout_weight="2"
+                  android:maxLength="1024"/>
+
+    </LinearLayout>
+
+</merge>
deleted file mode 100644
--- a/mobile/android/base/resources/layout/panel_grid_item_view.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android"
-       xmlns:gecko="http://schemas.android.com/apk/res-auto">
-
-    <org.mozilla.gecko.widget.SquaredImageView android:id="@+id/image"
-               style="@style/Widget.PanelGridItemImageView" />
-
-</merge>
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/panel_image_item.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <org.mozilla.gecko.widget.SquaredImageView
+        android:id="@+id/image"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:scaleType="centerCrop"
+        android:adjustViewBounds="true"
+        android:background="@color/panel_image_item_background"/>
+
+    <LinearLayout android:id="@+id/title_desc_container"
+                  android:layout_width="fill_parent"
+                  android:layout_height="@dimen/page_row_height"
+                  android:paddingTop="7dip"
+                  android:paddingBottom="7dip"
+                  android:paddingLeft="5dip"
+                  android:paddingRight="5dip"
+                  android:orientation="vertical">
+
+        <TextView android:id="@+id/title"
+                  style="@style/Widget.PanelItemView.Title"
+                  android:layout_width="fill_parent"
+                  android:layout_height="0dp"
+                  android:layout_weight="1"
+                  android:gravity="center_vertical"
+                  android:singleLine="true"/>
+
+        <TextView android:id="@+id/description"
+                  style="@style/Widget.PanelItemView.Description"
+                  android:layout_width="fill_parent"
+                  android:layout_height="0dp"
+                  android:layout_weight="1"
+                  android:layout_marginTop="3dp"
+                  android:singleLine="true"
+                  android:maxLength="1024"/>
+
+    </LinearLayout>
+
+</merge>
deleted file mode 100644
--- a/mobile/android/base/resources/layout/panel_list_row.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<org.mozilla.gecko.home.PanelListRow xmlns:android="http://schemas.android.com/apk/res/android"
-                                     android:layout_width="fill_parent"
-                                     android:layout_height="@dimen/page_row_height"
-                                     android:paddingLeft="10dip"
-                                     android:minHeight="@dimen/page_row_height"/>
--- a/mobile/android/base/resources/values-v11/themes.xml
+++ b/mobile/android/base/resources/values-v11/themes.xml
@@ -43,17 +43,16 @@
         <item name="menuItemActionViewStyle">@style/Widget.MenuItemActionView</item>
         <item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
         <item name="menuItemSecondaryActionBarStyle">@style/Widget.MenuItemSecondaryActionBar</item>
         <item name="menuItemShareActionButtonStyle">@style/Widget.MenuItemSecondaryActionBar</item>
         <item name="bookmarksListViewStyle">@style/Widget.BookmarksListView</item>
         <item name="topSitesGridItemViewStyle">@style/Widget.TopSitesGridItemView</item>
         <item name="topSitesGridViewStyle">@style/Widget.TopSitesGridView</item>
         <item name="panelGridViewStyle">@style/Widget.PanelGridView</item>
-        <item name="panelGridItemViewStyle">@style/Widget.PanelGridItemView</item>
         <item name="topSitesThumbnailViewStyle">@style/Widget.TopSitesThumbnailView</item>
         <item name="homeListViewStyle">@style/Widget.HomeListView</item>
         <item name="geckoMenuListViewStyle">@style/Widget.GeckoMenuListView</item>
         <item name="menuItemActionModeStyle">@style/GeckoActionBar.Button</item>
         <item name="android:actionModeStyle">@style/GeckoActionBar</item>
         <item name="android:actionButtonStyle">@style/GeckoActionBar.Button</item>
         <item name="android:actionModeCutDrawable">@drawable/ab_cut</item>
         <item name="android:actionModeCopyDrawable">@drawable/ab_copy</item>
--- a/mobile/android/base/resources/values/attrs.xml
+++ b/mobile/android/base/resources/values/attrs.xml
@@ -36,19 +36,16 @@
         <attr name="topSitesGridItemViewStyle" format="reference" />
 
         <!-- Default style for the HomeGridView -->
         <attr name="homeGridViewStyle" format="reference" />
 
         <!-- Style for the PanelGridView -->
         <attr name="panelGridViewStyle" format="reference" />
 
-        <!-- Default style for the PanelGridItemView -->
-        <attr name="panelGridItemViewStyle" format="reference" />
-
         <!-- Default style for the TopSitesGridView -->
         <attr name="topSitesGridViewStyle" format="reference" />
 
         <!-- Default style for the TopSitesThumbnailView -->
         <attr name="topSitesThumbnailViewStyle" format="reference" />
 
         <!-- Default style for the HomeListView -->
         <attr name="homeListViewStyle" format="reference" />
--- a/mobile/android/base/resources/values/colors.xml
+++ b/mobile/android/base/resources/values/colors.xml
@@ -85,11 +85,11 @@
   <color name="url_bar_urltext">#A6A6A6</color>
   <color name="url_bar_domaintext">#000</color>
   <color name="url_bar_domaintext_private">#FFF</color>
   <color name="url_bar_blockedtext">#b14646</color>
   <color name="url_bar_shadow">#12000000</color>
 
   <color name="home_last_tab_bar_bg">#FFF5F7F9</color>
 
-  <color name="panel_grid_item_image_background">#D1D9E1</color>
+  <color name="panel_image_item_background">#D1D9E1</color>
 </resources>
 
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -125,16 +125,31 @@
     </style>
 
     <style name="Widget.BookmarkFolderView" parent="Widget.TwoLineRow.Title">
         <item name="android:paddingLeft">10dip</item>
         <item name="android:drawablePadding">10dip</item>
         <item name="android:drawableLeft">@drawable/bookmark_folder</item>
     </style>
 
+    <style name="Widget.PanelItemView" />
+
+    <style name="Widget.PanelItemView.Title">
+        <item name="android:textAppearance">@style/TextAppearance.Widget.Home.ItemTitle</item>
+        <item name="android:maxLines">2</item>
+        <item name="android:ellipsize">end</item>
+    </style>
+
+    <style name="Widget.PanelItemView.Description">
+        <item name="android:textAppearance">@style/TextAppearance.Widget.Home.ItemDescription</item>
+        <item name="android:includeFontPadding">false</item>
+        <item name="android:maxLines">2</item>
+        <item name="android:ellipsize">end</item>
+    </style>
+
     <style name="Widget.HomeGridView" parent="Widget.GridView">
         <item name="android:padding">7dp</item>
         <item name="android:horizontalSpacing">0dp</item>
         <item name="android:verticalSpacing">7dp</item>
     </style>
 
     <style name="Widget.TopSitesGridView" parent="Widget.HomeGridView" />
 
@@ -151,29 +166,16 @@
         <item name="android:paddingTop">0dp</item>
         <item name="android:stretchMode">columnWidth</item>
         <item name="android:numColumns">auto_fit</item>
         <item name="android:columnWidth">@dimen/panel_grid_view_column_width</item>
         <item name="android:horizontalSpacing">2dp</item>
         <item name="android:verticalSpacing">2dp</item>
     </style>
 
-    <style name="Widget.PanelGridItemView">
-      <item name="android:layout_width">fill_parent</item>
-      <item name="android:layout_height">wrap_content</item>
-    </style>
-
-    <style name="Widget.PanelGridItemImageView">
-      <item name="android:layout_width">fill_parent</item>
-      <item name="android:layout_height">wrap_content</item>
-      <item name="android:scaleType">centerCrop</item>
-      <item name="android:adjustViewBounds">true</item>
-      <item name="android:background">@color/panel_grid_item_image_background</item>
-    </style>
-
     <style name="Widget.BookmarkItemView" parent="Widget.TwoLineRow"/>
 
     <style name="Widget.BookmarksListView" parent="Widget.HomeListView"/>
 
     <style name="Widget.TopSitesThumbnailView">
       <item name="android:padding">0dip</item>
       <item name="android:scaleType">centerCrop</item>
     </style>
--- a/mobile/android/base/resources/values/themes.xml
+++ b/mobile/android/base/resources/values/themes.xml
@@ -76,17 +76,16 @@
         <item name="android:editTextStyle">@style/Widget.EditText</item>
         <item name="android:gridViewStyle">@style/Widget.GridView</item>
         <item name="android:textViewStyle">@style/Widget.TextView</item>
         <item name="android:spinnerStyle">@style/Widget.Spinner</item>
         <item name="bookmarksListViewStyle">@style/Widget.BookmarksListView</item>
         <item name="topSitesGridItemViewStyle">@style/Widget.TopSitesGridItemView</item>
         <item name="topSitesGridViewStyle">@style/Widget.TopSitesGridView</item>
         <item name="panelGridViewStyle">@style/Widget.PanelGridView</item>
-        <item name="panelGridItemViewStyle">@style/Widget.PanelGridItemView</item>
         <item name="topSitesThumbnailViewStyle">@style/Widget.TopSitesThumbnailView</item>
         <item name="homeListViewStyle">@style/Widget.HomeListView</item>
         <item name="geckoMenuListViewStyle">@style/Widget.GeckoMenuListView</item>
         <item name="menuItemDefaultStyle">@style/Widget.MenuItemDefault</item>
         <item name="menuItemActionBarStyle">@style/Widget.MenuItemActionBar</item>
         <item name="menuItemActionModeStyle">@style/GeckoActionBar.Button</item>
     </style>