Bug 1325303 - A-S Telemetry: track position of highlights for menu interactions r=sebastian

MozReview-Commit-ID: GXl5asf2rEq

--HG--
extra : rebase_source : 9aa7ee95ed9fe563e31a276b6c0438faa72e9918
This commit is contained in:
Grigory Kruglov 2017-01-26 23:14:08 -08:00
Родитель e14db054b4
Коммит 771195ba7b
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -103,7 +103,7 @@ public class StreamRecyclerAdapter extends RecyclerView.Adapter<StreamItem> 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);
}

Просмотреть файл

@ -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());