Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2317)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionMainMenuFooter.java

Issue 2795653006: Add icon to the Data Saver main menu footer and update to spec (Closed)
Patch Set: new assets Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionMainMenuFooter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionMainMenuFooter.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionMainMenuFooter.java
index ec8dab9ad937e19b40b6ca64b7f00e55e5aa130f..13ab2699dc40e774a638683b8fa2dfce62bb24c2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionMainMenuFooter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionMainMenuFooter.java
@@ -6,13 +6,19 @@ package org.chromium.chrome.browser.preferences.datareduction;
import android.content.Context;
import android.content.Intent;
+import android.graphics.ColorMatrix;
+import android.graphics.ColorMatrixColorFilter;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
import android.text.format.DateUtils;
import android.text.format.Formatter;
import android.util.AttributeSet;
import android.view.View;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
@@ -35,7 +41,8 @@ public class DataReductionMainMenuFooter extends LinearLayout implements View.On
protected void onFinishInflate() {
super.onFinishInflate();
- TextView textSummary = (TextView) findViewById(R.id.menu_item_summary);
+ TextView itemText = (TextView) findViewById(R.id.menu_item_text);
+ TextView itemSummary = (TextView) findViewById(R.id.menu_item_summary);
if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
String dataSaved = Formatter.formatShortFileSize(getContext(),
@@ -44,14 +51,28 @@ public class DataReductionMainMenuFooter extends LinearLayout implements View.On
long millisSinceEpoch =
DataReductionProxySettings.getInstance().getDataReductionLastUpdateTime()
- DateUtils.DAY_IN_MILLIS * ChartDataUsageView.DAYS_IN_CHART;
- final int flags = DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_NO_YEAR;
+ final int flags = DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_NO_YEAR;
String date =
DateUtils.formatDateTime(getContext(), millisSinceEpoch, flags).toString();
- textSummary.setText(
- getContext().getString(R.string.data_reduction_saved_label, dataSaved, date));
+ itemText.setText(
+ getContext().getString(R.string.data_reduction_saved_label, dataSaved));
+ itemSummary.setText(getContext().getString(R.string.data_reduction_date_label, date));
+
+ int lightActiveColor = ApiCompatibilityUtils.getColor(
+ getContext().getResources(), R.color.light_active_color);
+ itemText.setTextColor(lightActiveColor);
} else {
- textSummary.setText(R.string.text_off);
+ itemText.setText(R.string.data_reduction_title);
+ itemSummary.setText(R.string.text_off);
+
+ // Make the icon grey.
+ ImageView icon = (ImageView) findViewById(R.id.chart_icon);
+ LayerDrawable layers = (LayerDrawable) icon.getDrawable();
+ Drawable chart = layers.findDrawableByLayerId(R.id.main_menu_chart);
+ ColorMatrix matrix = new ColorMatrix();
+ matrix.setSaturation(0);
+ icon.setColorFilter(new ColorMatrixColorFilter(matrix));
Ted C 2017/04/07 18:19:10 from TintedDrawable, we use: setColorFilter(<colo
megjablon 2017/04/07 20:03:26 Are we ok with keeping this as is or should I try
}
setOnClickListener(this);

Powered by Google App Engine
This is Rietveld 408576698