Bug 1410497 - review: Make names of openContextMenu unique. r=mcomella draft
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 31 Oct 2017 19:41:51 -0700
changeset 689878 7580c9092afa085d396c62336c01d898b6dac2c5
parent 689877 6d3716f1a1b3499177f1619f5ecbf857e1622386
child 738407 7015b93acb68872e727bde388144eb147ea5f827
push id87125
push usermichael.l.comella@gmail.com
push dateWed, 01 Nov 2017 02:42:22 +0000
reviewersmcomella
bugs1410497
milestone58.0a1
Bug 1410497 - review: Make names of openContextMenu unique. r=mcomella r=trivial (IDE assisted :) MozReview-Commit-ID: DNgY5v4zp2c
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/StreamRecyclerAdapter.java
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/StreamRecyclerAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/StreamRecyclerAdapter.java
@@ -134,28 +134,28 @@ public class StreamRecyclerAdapter exten
     @Override
     public StreamViewHolder onCreateViewHolder(final ViewGroup parent, final int type) {
         final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
 
         if (type == RowItemType.TOP_PANEL.getViewType()) {
             return new TopPanelRow(inflater.inflate(TopPanelRow.LAYOUT_ID, parent, false), onUrlOpenListener, new TopPanelRow.OnCardLongClickListener() {
                 @Override
                 public boolean onClick(final TopSite topSite, final int absolutePosition, final int faviconWidth, final int faviconHeight) {
-                    openContextMenu(topSite, absolutePosition, parent, faviconWidth, faviconHeight);
+                    openContextMenuForTopSite(topSite, absolutePosition, parent, faviconWidth, faviconHeight);
                     return true;
                 }
             });
         } else if (type == RowItemType.TOP_STORIES_TITLE.getViewType()) {
             return new StreamTitleRow(inflater.inflate(StreamTitleRow.LAYOUT_ID, parent, false), R.string.activity_stream_topstories, R.string.activity_stream_link_more, LINK_MORE_POCKET, onUrlOpenListener);
         } else if (type == RowItemType.TOP_STORIES_ITEM.getViewType() ||
                 type == RowItemType.HIGHLIGHT_ITEM.getViewType()) {
             return new WebpageItemRow(inflater.inflate(WebpageItemRow.LAYOUT_ID, parent, false), new WebpageItemRow.OnMenuButtonClickListener() {
                 @Override
                 public void onMenuButtonClicked(final WebpageItemRow row, final int position) {
-                    openContextMenu(row, position, parent, ActivityStreamTelemetry.Contract.INTERACTION_MENU_BUTTON);
+                    openContextMenuForWebpageItemRow(row, position, parent, ActivityStreamTelemetry.Contract.INTERACTION_MENU_BUTTON);
                 }
             });
         } else if (type == RowItemType.HIGHLIGHTS_TITLE.getViewType()) {
             return new StreamTitleRow(inflater.inflate(StreamTitleRow.LAYOUT_ID, parent, false), R.string.activity_stream_highlights);
         } else if (type == RowItemType.HIGHLIGHTS_EMPTY_STATE.getViewType()) {
             return new HighlightsEmptyStateRow(inflater.inflate(HighlightsEmptyStateRow.LAYOUT_ID, parent, false));
         } else if (type == RowItemType.LEARN_MORE_LINK.getViewType()) {
             return new LearnMoreRow(inflater.inflate(LearnMoreRow.LAYOUT_ID, parent, false));
@@ -293,17 +293,17 @@ public class StreamRecyclerAdapter exten
 
     @Override
     public boolean onItemLongClicked(final RecyclerView recyclerView, final int position, final View v) {
         if (!onItemClickIsValidRowItem(position)) {
             return false;
         }
 
         final WebpageItemRow highlightItem = (WebpageItemRow) recyclerView.getChildViewHolder(v);
-        openContextMenu(highlightItem, position, recyclerView, ActivityStreamTelemetry.Contract.INTERACTION_LONG_CLICK);
+        openContextMenuForWebpageItemRow(highlightItem, position, recyclerView, ActivityStreamTelemetry.Contract.INTERACTION_LONG_CLICK);
         return true;
     }
 
     private boolean onItemClickIsValidRowItem(final int position) {
         // The position this method receives is from RecyclerView.ViewHolder.getAdapterPosition, whose docs state:
         // "Note that if you've called notifyDataSetChanged(), until the next layout pass, the return value of this
         // method will be NO_POSITION."
         //
@@ -323,17 +323,17 @@ public class StreamRecyclerAdapter exten
                 && viewType != RowItemType.TOP_STORIES_ITEM.getViewType()) {
             // Headers (containing topsites and/or the highlights title) do their own click handling as needed
             return false;
         }
 
         return true;
     }
 
-    private void openContextMenu(final WebpageItemRow webpageItemRow, final int position, final View snackbarAnchor,
+    private void openContextMenuForWebpageItemRow(final WebpageItemRow webpageItemRow, final int position, final View snackbarAnchor,
             @NonNull final String interactionExtra) {
         final WebpageRowModel model = (WebpageRowModel) recyclerViewModel.get(position);
 
         final String sourceType;
         final int actionPosition;
         final ActivityStreamContextMenu.MenuMode menuMode;
 
         ActivityStreamTelemetry.Extras.Builder extras = ActivityStreamTelemetry.Extras.builder();
@@ -352,17 +352,17 @@ public class StreamRecyclerAdapter exten
               .set(ActivityStreamTelemetry.Contract.ACTION_POSITION, actionPosition)
               .set(ActivityStreamTelemetry.Contract.INTERACTION, interactionExtra);
 
         openContextMenuInner(snackbarAnchor, extras, menuMode, model,
                 /* shouldOverrideWithImageProvider */ true, // we use image providers in HighlightItem.pageIconLayout.
                 webpageItemRow.getTileWidth(), webpageItemRow.getTileHeight());
     }
 
-    private void openContextMenu(final TopSite topSite, final int absolutePosition, final View snackbarAnchor,
+    private void openContextMenuForTopSite(final TopSite topSite, final int absolutePosition, final View snackbarAnchor,
             final int faviconWidth, final int faviconHeight) {
         ActivityStreamTelemetry.Extras.Builder extras = ActivityStreamTelemetry.Extras.builder()
                 .forTopSite(topSite)
                 .set(ActivityStreamTelemetry.Contract.ACTION_POSITION, absolutePosition);
 
         openContextMenuInner(snackbarAnchor, extras, ActivityStreamContextMenu.MenuMode.TOPSITE, topSite,
                 /* shouldOverrideWithImageProvider */ false, // we only use favicons for top sites.
                 faviconWidth, faviconHeight);