Bug 1379021 - Remove code to resize highlights tiles dynamically. r?grisha
MozReview-Commit-ID: 3JMlnwJVHEj
--- a/mobile/android/app/src/main/res/layout/activity_stream_highlights_item.xml
+++ b/mobile/android/app/src/main/res/layout/activity_stream_highlights_item.xml
@@ -1,56 +1,45 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
+<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:gecko="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:paddingBottom="8dp">
- <FrameLayout
- android:id="@+id/icon_wrapper"
+ <org.mozilla.gecko.widget.FaviconView
+ android:id="@+id/icon"
android:layout_width="100dp"
android:layout_height="75dp"
+ android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
- tools:background="#ff0000">
-
- <org.mozilla.gecko.widget.FaviconView
- android:id="@+id/icon"
- android:layout_width="@dimen/favicon_bg"
- android:layout_height="@dimen/favicon_bg"
- android:layout_gravity="center"
- gecko:enableRoundCorners="false"
- tools:background="@drawable/favicon_globe"
- tools:layout_editor_absoluteX="13dp"
- tools:layout_editor_absoluteY="13dp" />
-
- </FrameLayout>
+ gecko:enableRoundCorners="false"
+ tools:background="@drawable/favicon_globe" />
<TextView
android:id="@+id/page"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:lines="1"
+ android:textColor="@color/activity_stream_subtitle"
android:textSize="12sp"
- android:textColor="@color/activity_stream_subtitle"
app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintLeft_toRightOf="@+id/icon_wrapper"
+ app:layout_constraintLeft_toRightOf="@+id/icon"
app:layout_constraintRight_toLeftOf="@+id/menu"
app:layout_constraintTop_toTopOf="parent"
tools:text="vimeo" />
<TextView
android:id="@+id/card_history_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -58,28 +47,28 @@
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:maxLines="3"
android:textColor="#ff000000"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintLeft_toRightOf="@+id/icon_wrapper"
+ app:layout_constraintLeft_toRightOf="@+id/icon"
app:layout_constraintRight_toLeftOf="@+id/menu"
app:layout_constraintTop_toBottomOf="@+id/page"
tools:text="Should Your Team Buy Or Sell At the MLB Trade Deadline?" />
<ImageView
android:id="@+id/source_icon"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
- app:layout_constraintLeft_toRightOf="@+id/icon_wrapper"
+ app:layout_constraintLeft_toRightOf="@+id/icon"
app:layout_constraintTop_toBottomOf="@+id/card_history_label"
tools:src="@drawable/ic_as_bookmarked" />
<TextView
android:id="@+id/card_history_source"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/StreamRecyclerAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/StreamRecyclerAdapter.java
@@ -103,17 +103,17 @@ public class StreamRecyclerAdapter exten
public void onBindViewHolder(StreamItem holder, int position) {
int type = getItemViewType(position);
if (type == HighlightItem.LAYOUT_ID) {
final int actualPosition = translatePositionToCursor(position);
final Highlight highlight = highlights.get(actualPosition);
- ((HighlightItem) holder).bind(highlight, actualPosition, tilesWidth, tilesHeight);
+ ((HighlightItem) holder).bind(highlight, actualPosition);
} else if (type == TopPanel.LAYOUT_ID) {
((TopPanel) holder).bind(topSitesCursor, tiles, tilesWidth, tilesHeight);
}
}
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View v) {
if (getItemViewType(position) != HighlightItem.LAYOUT_ID) {
--- 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
@@ -92,27 +92,22 @@ public class HighlightItem extends Strea
extras.build()
);
}
});
ViewUtil.enableTouchRipple(menuButton);
}
- public void bind(Highlight highlight, int position, int tilesWidth, int tilesHeight) {
+ public void bind(Highlight highlight, int position) {
this.highlight = highlight;
this.position = position;
vLabel.setText(highlight.getTitle());
- ViewGroup.LayoutParams layoutParams = vIconView.getLayoutParams();
- layoutParams.width = tilesWidth - tilesMargin;
- layoutParams.height = tilesHeight;
- vIconView.setLayoutParams(layoutParams);
-
updateUiForSource(highlight.getSource());
updatePage();
if (ongoingIconLoad != null) {
ongoingIconLoad.cancel(true);
}
ongoingIconLoad = Icons.with(itemView.getContext())