Bug 1377287: Rename HighlightItem internal views to something easier. r=sebastian
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 17 Jul 2017 13:20:29 -0700
changeset 419905 f981c0d4269fc7b3621318522b0fd19167f81060
parent 419904 ab2472a1042bb5fbd0140ada5a972411b3f32494
child 419906 be3b083e82b8a0eb76d1094f63d3290a8ee8e2bf
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1377287, 1379021
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377287: Rename HighlightItem internal views to something easier. r=sebastian I could not make sense of the existing names at all. Bug 1379021 is going to: - Remove the vTimeSince view, so I didn't change the name - Create a new layout file, so I didn't change the resource IDs accordingly MozReview-Commit-ID: 1WUzyhrzQYZ
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/stream/HighlightItem.java
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/stream/HighlightItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/stream/HighlightItem.java
@@ -36,39 +36,39 @@ import static org.mozilla.gecko.activity
 public class HighlightItem extends StreamItem implements IconCallback {
     private static final String LOGTAG = "GeckoHighlightItem";
 
     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;
+    private final FaviconView pageIconView;
+    private final TextView pageTitleView;
     private final TextView vTimeSince;
-    private final TextView vSourceView;
-    private final TextView vPageView;
-    private final ImageView vSourceIconView;
+    private final TextView pageSourceView;
+    private final TextView pageDomainView;
+    private final ImageView pageSourceIconView;
 
     private Future<IconResponse> ongoingIconLoad;
     private int tilesMargin;
 
     public HighlightItem(final View itemView,
                          final HomePager.OnUrlOpenListener onUrlOpenListener,
                          final HomePager.OnUrlOpenInBackgroundListener onUrlOpenInBackgroundListener) {
         super(itemView);
 
         tilesMargin = itemView.getResources().getDimensionPixelSize(R.dimen.activity_stream_base_margin);
 
-        vLabel = (TextView) itemView.findViewById(R.id.card_history_label);
+        pageTitleView = (TextView) itemView.findViewById(R.id.card_history_label);
         vTimeSince = (TextView) itemView.findViewById(R.id.card_history_time_since);
-        vIconView = (FaviconView) itemView.findViewById(R.id.icon);
-        vSourceView = (TextView) itemView.findViewById(R.id.card_history_source);
-        vPageView = (TextView) itemView.findViewById(R.id.page);
-        vSourceIconView = (ImageView) itemView.findViewById(R.id.source_icon);
+        pageIconView = (FaviconView) itemView.findViewById(R.id.icon);
+        pageSourceView = (TextView) itemView.findViewById(R.id.card_history_source);
+        pageDomainView = (TextView) itemView.findViewById(R.id.page);
+        pageSourceIconView = (ImageView) itemView.findViewById(R.id.source_icon);
 
         final ImageView menuButton = (ImageView) itemView.findViewById(R.id.menu);
 
         menuButton.setImageDrawable(
                 DrawableUtil.tintDrawable(menuButton.getContext(), R.drawable.menu, Color.LTGRAY));
 
         TouchTargetUtil.ensureTargetHitArea(menuButton, itemView);
 
@@ -81,40 +81,40 @@ public class HighlightItem extends Strea
                         .forHighlightSource(highlight.getSource());
 
                 ActivityStreamContextMenu.show(itemView.getContext(),
                         menuButton,
                         extras,
                         ActivityStreamContextMenu.MenuMode.HIGHLIGHT,
                         highlight,
                         onUrlOpenListener, onUrlOpenInBackgroundListener,
-                        vIconView.getWidth(), vIconView.getHeight());
+                        pageIconView.getWidth(), pageIconView.getHeight());
 
                 Telemetry.sendUIEvent(
                         TelemetryContract.Event.SHOW,
                         TelemetryContract.Method.CONTEXT_MENU,
                         extras.build()
                 );
             }
         });
 
         ViewUtil.enableTouchRipple(menuButton);
     }
 
     public void bind(Highlight highlight, int position, int tilesWidth, int tilesHeight) {
         this.highlight = highlight;
         this.position = position;
 
-        vLabel.setText(highlight.getTitle());
+        pageTitleView.setText(highlight.getTitle());
         vTimeSince.setText(highlight.getRelativeTimeSpan());
 
-        ViewGroup.LayoutParams layoutParams = vIconView.getLayoutParams();
+        ViewGroup.LayoutParams layoutParams = pageIconView.getLayoutParams();
         layoutParams.width = tilesWidth - tilesMargin;
         layoutParams.height = tilesHeight;
-        vIconView.setLayoutParams(layoutParams);
+        pageIconView.setLayoutParams(layoutParams);
 
         updateUiForSource(highlight.getSource());
         updatePage();
 
         if (ongoingIconLoad != null) {
             ongoingIconLoad.cancel(true);
         }
 
@@ -123,45 +123,45 @@ public class HighlightItem extends Strea
                 .skipNetwork()
                 .build()
                 .execute(this);
     }
 
     private void updateUiForSource(Utils.HighlightSource source) {
         switch (source) {
             case BOOKMARKED:
-                vSourceView.setText(R.string.activity_stream_highlight_label_bookmarked);
-                vSourceView.setVisibility(View.VISIBLE);
-                vSourceIconView.setImageResource(R.drawable.ic_as_bookmarked);
+                pageSourceView.setText(R.string.activity_stream_highlight_label_bookmarked);
+                pageSourceView.setVisibility(View.VISIBLE);
+                pageSourceIconView.setImageResource(R.drawable.ic_as_bookmarked);
                 break;
             case VISITED:
-                vSourceView.setText(R.string.activity_stream_highlight_label_visited);
-                vSourceView.setVisibility(View.VISIBLE);
-                vSourceIconView.setImageResource(R.drawable.ic_as_visited);
+                pageSourceView.setText(R.string.activity_stream_highlight_label_visited);
+                pageSourceView.setVisibility(View.VISIBLE);
+                pageSourceIconView.setImageResource(R.drawable.ic_as_visited);
                 break;
             default:
-                vSourceView.setVisibility(View.INVISIBLE);
-                vSourceIconView.setImageResource(0);
+                pageSourceView.setVisibility(View.INVISIBLE);
+                pageSourceIconView.setImageResource(0);
                 break;
         }
     }
 
     private void updatePage() {
         // First try to set the provider name from the page's metadata.
         if (highlight.getMetadata().hasProvider()) {
-            vPageView.setText(highlight.getMetadata().getProvider());
+            pageDomainView.setText(highlight.getMetadata().getProvider());
             return;
         }
 
         // If there's no provider name available then let's try to extract one from the URL.
         extractLabel(itemView.getContext(), highlight.getUrl(), false, new ActivityStream.LabelCallback() {
             @Override
             public void onLabelExtracted(String label) {
-                vPageView.setText(TextUtils.isEmpty(label) ? highlight.getUrl() : label);
+                pageDomainView.setText(TextUtils.isEmpty(label) ? highlight.getUrl() : label);
             }
         });
     }
 
     @Override
     public void onIconResponse(IconResponse response) {
-        vIconView.updateImage(response);
+        pageIconView.updateImage(response);
     }
 }