Bug 1312467 - Also store topsites title in TopSite data structure r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 25 Oct 2016 11:20:06 -0700
changeset 431764 66cd4d7d044bcbe09ca700b3d5fdd0315f38a347
parent 431763 d28412cf0806f784dec2ee716825d7c94c91eaf7
child 431765 024682b6fe54e40bdd8e3f480b816b31f71cc115
push id34103
push userahunt@mozilla.com
push dateMon, 31 Oct 2016 14:45:09 +0000
reviewerssebastian
bugs1312467
milestone52.0a1
Bug 1312467 - Also store topsites title in TopSite data structure r?sebastian MozReview-Commit-ID: FlWeufLHjPE
mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesPageAdapter.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesPageAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesPageAdapter.java
@@ -18,20 +18,22 @@ import org.mozilla.gecko.db.BrowserContr
 
 import java.util.ArrayList;
 import java.util.List;
 
 public class TopSitesPageAdapter extends RecyclerView.Adapter<TopSitesCard> {
     static final class TopSite {
         public final long id;
         public final String url;
+        public final String title;
 
-        TopSite(long id, String url) {
+        TopSite(long id, String url, String title) {
             this.id = id;
             this.url = url;
+            this.title = title;
         }
     }
 
     private List<TopSite> topSites;
     private int tiles;
     private int tilesWidth;
     private int tilesHeight;
     private int textHeight;
@@ -61,18 +63,19 @@ public class TopSitesPageAdapter extends
 
         for (int i = 0; i < tiles && startIndex + i < cursor.getCount(); i++) {
             cursor.moveToPosition(startIndex + i);
 
             // The Combined View only contains pages that have been visited at least once, i.e. any
             // page in the TopSites query will contain a HISTORY_ID. _ID however will be 0 for all rows.
             final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BrowserContract.Combined.HISTORY_ID));
             final String url = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.URL));
+            final String title = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.TITLE));
 
-            topSites.add(new TopSite(id, url));
+            topSites.add(new TopSite(id, url, title));
         }
 
         notifyDataSetChanged();
     }
 
     @Override
     public void onBindViewHolder(TopSitesCard holder, int position) {
         holder.bind(topSites.get(position));