Bug 1317631 - Only handle clicks for highlights r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Tue, 15 Nov 2016 17:01:46 +0800
changeset 439458 a934adf92ce2379fb76a2da96b804ddecd685952
parent 438818 5e76768327660437bf3486554ad318e4b70276e1
child 439459 0154e33fc42158832d08f98c5ac98f122698d7a2
push id36002
push userahunt@mozilla.com
push dateWed, 16 Nov 2016 01:39:50 +0000
reviewerssebastian
bugs1317631
milestone53.0a1
Bug 1317631 - Only handle clicks for highlights r?sebastian This avoids us trying to obtain an invalid cursor position, since the cursor only maps to highlights items (and not the headers). MozReview-Commit-ID: 1NtJuvDRa5r
mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java
@@ -89,18 +89,18 @@ public class StreamRecyclerAdapter exten
             ((HighlightItem) holder).bind(highlightsCursor, tilesWidth,  tilesHeight);
         } else if (type == TopPanel.LAYOUT_ID) {
             ((TopPanel) holder).bind(topSitesCursor, tiles, tilesWidth, tilesHeight);
         }
     }
 
     @Override
     public void onItemClicked(RecyclerView recyclerView, int position, View v) {
-        if (position < 1) {
-            // The header contains top sites and has its own click handling.
+        if (getItemViewType(position) != HighlightItem.LAYOUT_ID) {
+            // Headers (containing topsites and/or the highlights title) do their own click handling as needed
             return;
         }
 
         highlightsCursor.moveToPosition(
                 translatePositionToCursor(position));
 
         final String url = highlightsCursor.getString(
                 highlightsCursor.getColumnIndexOrThrow(BrowserContract.Combined.URL));