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

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: 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..a9a6ea3b830eeba4ee854c3ad9f799cc70076fe4 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
@@ -10,9 +10,11 @@ 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 +37,9 @@ 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);
+ ImageView icon = (ImageView) findViewById(R.id.menu_item_icon);
if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
String dataSaved = Formatter.formatShortFileSize(getContext(),
@@ -44,14 +48,22 @@ 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));
+ icon.setImageResource(R.drawable.data_reduction_main_menu_on);
+
+ 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);
+ icon.setImageResource(R.drawable.data_reduction_main_menu_off);
}
setOnClickListener(this);

Powered by Google App Engine
This is Rietveld 408576698