Bug 1306609 - Rename CompactItem to HighlightsItem. r?ahunt draft
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 05 Oct 2016 14:19:49 +0200
changeset 421154 abf9fd2ab6a43f934e7b9444cc2288e39469b4cf
parent 421153 f63a277b9d37b13b5f508081ccc159486a92d622
child 421287 b30134c91cabe8b2926c8d61d6c81e9b5bfdc61f
push id31407
push users.kaspari@gmail.com
push dateWed, 05 Oct 2016 12:20:58 +0000
reviewersahunt
bugs1306609
milestone52.0a1
Bug 1306609 - Rename CompactItem to HighlightsItem. r?ahunt MozReview-Commit-ID: JX76g6HnG7g
mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamItem.java
mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamItem.java
@@ -55,27 +55,27 @@ public abstract class StreamItem extends
     public static class BottomPanel extends StreamItem {
         public static final int LAYOUT_ID = R.layout.activity_stream_main_bottompanel;
 
         public BottomPanel(View itemView) {
             super(itemView);
         }
     }
 
-    public static class CompactItem extends StreamItem implements IconCallback {
+    public static class HighlightItem extends StreamItem implements IconCallback {
         public static final int LAYOUT_ID = R.layout.activity_stream_card_history_item;
 
         final FaviconView vIconView;
         final TextView vLabel;
         final TextView vTimeSince;
         final TextView vSourceView;
 
         private Future<IconResponse> ongoingIconLoad;
 
-        public CompactItem(View itemView) {
+        public HighlightItem(View itemView) {
             super(itemView);
             vLabel = (TextView) itemView.findViewById(R.id.card_history_label);
             vTimeSince = (TextView) itemView.findViewById(R.id.card_history_time_since);
             vIconView = (FaviconView) itemView.findViewById(R.id.icon);
             vSourceView = (TextView) itemView.findViewById(R.id.card_history_source);
         }
 
         @Override
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java
@@ -6,17 +6,17 @@ package org.mozilla.gecko.home.activitys
 
 import android.database.Cursor;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.ViewGroup;
 
 import org.mozilla.gecko.home.HomePager;
 import org.mozilla.gecko.home.activitystream.StreamItem.BottomPanel;
-import org.mozilla.gecko.home.activitystream.StreamItem.CompactItem;
+import org.mozilla.gecko.home.activitystream.StreamItem.HighlightItem;
 import org.mozilla.gecko.home.activitystream.StreamItem.TopPanel;
 
 public class StreamRecyclerAdapter extends RecyclerView.Adapter<StreamItem> {
     private Cursor highlightsCursor;
     private Cursor topSitesCursor;
 
     private HomePager.OnUrlOpenListener onUrlOpenListener;
 
@@ -26,30 +26,30 @@ public class StreamRecyclerAdapter exten
 
     @Override
     public int getItemViewType(int position) {
         if (position == 0) {
             return TopPanel.LAYOUT_ID;
         } else if (position == getItemCount() - 1) {
             return BottomPanel.LAYOUT_ID;
         } else {
-            return CompactItem.LAYOUT_ID;
+            return HighlightItem.LAYOUT_ID;
         }
     }
 
     @Override
     public StreamItem onCreateViewHolder(ViewGroup parent, final int type) {
         final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
 
         if (type == TopPanel.LAYOUT_ID) {
             return new TopPanel(inflater.inflate(type, parent, false), onUrlOpenListener);
         } else if (type == BottomPanel.LAYOUT_ID) {
                 return new BottomPanel(inflater.inflate(type, parent, false));
-        } else if (type == CompactItem.LAYOUT_ID) {
-            return new CompactItem(inflater.inflate(type, parent, false));
+        } else if (type == HighlightItem.LAYOUT_ID) {
+            return new HighlightItem(inflater.inflate(type, parent, false));
         } else {
             throw new IllegalStateException("Missing inflation for ViewType " + type);
         }
     }
 
     private int translatePositionToCursor(int position) {
         if (position == 0 ||
             position == getItemCount() - 1) {
@@ -59,17 +59,17 @@ public class StreamRecyclerAdapter exten
         // We have one blank panel at the top, hence remove that to obtain the cursor position
         return position - 1;
     }
 
     @Override
     public void onBindViewHolder(StreamItem holder, int position) {
         int type = getItemViewType(position);
 
-        if (type == CompactItem.LAYOUT_ID) {
+        if (type == HighlightItem.LAYOUT_ID) {
             final int cursorPosition = translatePositionToCursor(position);
 
             highlightsCursor.moveToPosition(cursorPosition);
             holder.bind(highlightsCursor);
         } else if (type == TopPanel.LAYOUT_ID) {
             holder.bind(topSitesCursor);
         }
     }