From 771195ba7b50167e5ae485b2d768c5dd024e411c Mon Sep 17 00:00:00 2001 From: Grigory Kruglov Date: Thu, 26 Jan 2017 23:14:08 -0800 Subject: [PATCH] Bug 1325303 - A-S Telemetry: track position of highlights for menu interactions r=sebastian MozReview-Commit-ID: GXl5asf2rEq --HG-- extra : rebase_source : 9aa7ee95ed9fe563e31a276b6c0438faa72e9918 --- .../gecko/home/activitystream/StreamRecyclerAdapter.java | 2 +- .../gecko/home/activitystream/stream/HighlightItem.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java index 22a1fb41ad0e..ce0f11c90eaf 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/StreamRecyclerAdapter.java @@ -103,7 +103,7 @@ public class StreamRecyclerAdapter extends RecyclerView.Adapter impl final int cursorPosition = translatePositionToCursor(position); highlightsCursor.moveToPosition(cursorPosition); - ((HighlightItem) holder).bind(highlightsCursor, tilesWidth, tilesHeight); + ((HighlightItem) holder).bind(highlightsCursor, cursorPosition, tilesWidth, tilesHeight); } else if (type == TopPanel.LAYOUT_ID) { ((TopPanel) holder).bind(topSitesCursor, tiles, tilesWidth, tilesHeight); } diff --git a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java index 6c4c28409e22..73707aedcda3 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java @@ -40,6 +40,7 @@ public class HighlightItem extends StreamItem implements IconCallback { public static final int LAYOUT_ID = R.layout.activity_stream_card_history_item; private Highlight highlight; + private int position; private final FaviconView vIconView; private final TextView vLabel; @@ -77,6 +78,7 @@ public class HighlightItem extends StreamItem implements IconCallback { public void onClick(View v) { ActivityStreamTelemetry.Extras.Builder extras = ActivityStreamTelemetry.Extras.builder() .set(ActivityStreamTelemetry.Contract.SOURCE_TYPE, ActivityStreamTelemetry.Contract.TYPE_HIGHLIGHTS) + .set(ActivityStreamTelemetry.Contract.ACTION_POSITION, position) .forHighlightSource(highlight.getSource()); ActivityStreamContextMenu.show(v.getContext(), @@ -98,8 +100,9 @@ public class HighlightItem extends StreamItem implements IconCallback { ViewUtil.enableTouchRipple(menuButton); } - public void bind(Cursor cursor, int tilesWidth, int tilesHeight) { - highlight = Highlight.fromCursor(cursor); + public void bind(Cursor cursor, int position, int tilesWidth, int tilesHeight) { + this.highlight = Highlight.fromCursor(cursor); + this.position = position; vLabel.setText(highlight.getTitle()); vTimeSince.setText(highlight.getRelativeTimeSpan());