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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java

Issue 2738503007: POC: Use a tint list to change colors (Closed)
Patch Set: Stop calling notifyDataSetChanged() when tapping on item Created 3 years, 9 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/BluetoothChooserDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
index 8c969373d3250eba2ad88a1c46dc0e13e707560c..5079424866bafd74da50e3e1db3ac146fe6d0176 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java
@@ -11,6 +11,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
@@ -73,7 +74,6 @@ public class BluetoothChooserDialog
int mSecurityLevel;
private Drawable mConnectedIcon;
- private Drawable mConnectedSelectedIcon;
private String mConnectedIconDescription;
// A pointer back to the native part of the implementation for this dialog.
@@ -130,11 +130,13 @@ public class BluetoothChooserDialog
Resources res = mActivity.getResources();
// Initialize icons.
+ ColorStateList iconColorList =
+ ApiCompatibilityUtils.getColorStateList(res, R.color.item_chooser_row_icon_color);
+
mConnectedIcon = VectorDrawableCompat.create(
res, R.drawable.ic_bluetooth_connected, mActivity.getTheme());
- DrawableCompat.setTint(
- mConnectedIcon, ApiCompatibilityUtils.getColor(res, R.color.google_grey_600));
- mConnectedSelectedIcon = getSelectedIcon(res, mConnectedIcon);
+ DrawableCompat.setTintList(mConnectedIcon, iconColorList);
+
mConnectedIconDescription = mActivity.getString(R.string.bluetooth_device_connected);
if (mAdapter == null) {
@@ -384,7 +386,8 @@ public class BluetoothChooserDialog
@VisibleForTesting
ItemChooserDialog.ItemChooserRowIcon createConnectedRowIcon() {
return new ItemChooserDialog.ItemChooserRowIcon(
- mConnectedIcon, mConnectedSelectedIcon, mConnectedIconDescription);
+ mConnectedIcon.getConstantState().newDrawable().mutate(),
+ mConnectedIconDescription);
}
@VisibleForTesting

Powered by Google App Engine
This is Rietveld 408576698