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 58ac77967ca6b7afc8ccbfeb684878c2345970e9..b85833fef426e7bce63d6c6677c918ad6de5e248 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java |
@@ -13,6 +13,7 @@ import android.content.Intent; |
import android.content.IntentFilter; |
import android.content.res.Resources; |
import android.graphics.drawable.Drawable; |
+import android.graphics.drawable.LevelListDrawable; |
import android.location.LocationManager; |
import android.support.graphics.drawable.VectorDrawableCompat; |
import android.support.v4.graphics.drawable.DrawableCompat; |
@@ -77,7 +78,7 @@ public class BluetoothChooserDialog |
@VisibleForTesting |
String mConnectedIconDescription; |
@VisibleForTesting |
- Drawable[] mSignalStrengthLevelIcon; |
+ LevelListDrawable mSignalStrengthLevelIcon; |
// A pointer back to the native part of the implementation for this dialog. |
long mNativeBluetoothChooserDialogPtr; |
@@ -134,12 +135,17 @@ public class BluetoothChooserDialog |
mConnectedIcon = getIconWithRowIconColorStateList(R.drawable.ic_bluetooth_connected); |
mConnectedIconDescription = mActivity.getString(R.string.bluetooth_device_connected); |
- mSignalStrengthLevelIcon = new Drawable[] { |
- getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_0_bar), |
- getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_1_bar), |
- getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_2_bar), |
- getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_3_bar), |
- getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_4_bar)}; |
+ mSignalStrengthLevelIcon = new LevelListDrawable(); |
+ mSignalStrengthLevelIcon.addLevel( |
+ 0, 0, getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_0_bar)); |
+ mSignalStrengthLevelIcon.addLevel( |
+ 1, 1, getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_1_bar)); |
+ mSignalStrengthLevelIcon.addLevel( |
+ 2, 2, getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_2_bar)); |
+ mSignalStrengthLevelIcon.addLevel( |
+ 3, 3, getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_3_bar)); |
+ mSignalStrengthLevelIcon.addLevel( |
+ 4, 4, getIconWithRowIconColorStateList(R.drawable.ic_signal_cellular_4_bar)); |
if (mAdapter == null) { |
Log.i(TAG, "BluetoothChooserDialog: Default Bluetooth adapter not found."); |
@@ -393,7 +399,8 @@ public class BluetoothChooserDialog |
icon = mConnectedIcon.getConstantState().newDrawable(); |
iconDescription = mConnectedIconDescription; |
} else if (signalStrengthLevel != -1) { |
- icon = mSignalStrengthLevelIcon[signalStrengthLevel].getConstantState().newDrawable(); |
+ icon = mSignalStrengthLevelIcon.getConstantState().newDrawable(); |
ortuno
2017/04/26 01:06:45
This line makes the dialog pretty unusable. Since
|
+ icon.setLevel(signalStrengthLevel); |
iconDescription = mActivity.getResources().getQuantityString( |
R.plurals.signal_strength_level_n_bars, signalStrengthLevel, |
signalStrengthLevel); |