Bug 1306608 - Activity Stream top sites: Update menu button style. r?grisha
MozReview-Commit-ID: 6iEpdyvcURF
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesCard.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesCard.java
@@ -1,49 +1,49 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* 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/. */
+
package org.mozilla.gecko.home.activitystream.topsites;
import android.database.Cursor;
+import android.graphics.Color;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
-import android.view.View;
+import android.widget.ImageView;
import android.widget.TextView;
import org.mozilla.gecko.R;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.icons.IconCallback;
import org.mozilla.gecko.icons.IconResponse;
import org.mozilla.gecko.icons.Icons;
+import org.mozilla.gecko.util.DrawableUtil;
import org.mozilla.gecko.widget.FaviconView;
import java.util.concurrent.Future;
class TopSitesCard extends RecyclerView.ViewHolder implements IconCallback {
private final FaviconView faviconView;
-
private final TextView title;
- private final View menuButton;
+ private final ImageView menuButton;
private Future<IconResponse> ongoingIconLoad;
- private String url;
-
- public TopSitesCard(CardView card) {
+ /* package */ TopSitesCard(CardView card) {
super(card);
faviconView = (FaviconView) card.findViewById(R.id.favicon);
title = (TextView) card.findViewById(R.id.title);
- menuButton = card.findViewById(R.id.menu);
+ menuButton = (ImageView) card.findViewById(R.id.menu);
}
void bind(Cursor cursor) {
- this.url = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.URL));
+ final String url = cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.URL));
title.setText(cursor.getString(cursor.getColumnIndexOrThrow(BrowserContract.Combined.TITLE)));
if (ongoingIconLoad != null) {
ongoingIconLoad.cancel(true);
}
ongoingIconLoad = Icons.with(itemView.getContext())
@@ -51,10 +51,15 @@ class TopSitesCard extends RecyclerView.
.skipNetwork()
.build()
.execute(this);
}
@Override
public void onIconResponse(IconResponse response) {
faviconView.updateImage(response);
+
+ final int tintColor = !response.hasColor() || response.getColor() == Color.WHITE ? Color.LTGRAY : Color.WHITE;
+
+ menuButton.setImageDrawable(
+ DrawableUtil.tintDrawable(menuButton.getContext(), R.drawable.menu, tintColor));
}
}
--- a/mobile/android/base/resources/layout/activity_stream_topsites_card.xml
+++ b/mobile/android/base/resources/layout/activity_stream_topsites_card.xml
@@ -34,19 +34,19 @@
android:lines="1"
android:padding="4dp"
android:textColor="@android:color/black"
tools:text="Lorem Ipsum here is a title"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<ImageView
- android:id="@+id/menu_button"
+ android:id="@+id/menu"
android:layout_width="wrap_content"
- android:layout_height="32dp"
+ android:layout_height="28dp"
android:layout_gravity="right|top"
android:padding="6dp"
android:src="@drawable/menu"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>