Merge "Update the bt background color." into oc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4a324cb196
@@ -73,7 +73,7 @@ public class BluetoothDeviceLayerDrawable extends LayerDrawable {
|
|||||||
final Drawable deviceDrawable = context.getDrawable(resId);
|
final Drawable deviceDrawable = context.getDrawable(resId);
|
||||||
|
|
||||||
final BatteryMeterDrawable batteryDrawable = new BatteryMeterDrawable(context,
|
final BatteryMeterDrawable batteryDrawable = new BatteryMeterDrawable(context,
|
||||||
R.color.meter_background_color, batteryLevel);
|
context.getColor(R.color.meter_background_color), batteryLevel);
|
||||||
final int pad = context.getResources().getDimensionPixelSize(R.dimen.bt_battery_padding);
|
final int pad = context.getResources().getDimensionPixelSize(R.dimen.bt_battery_padding);
|
||||||
batteryDrawable.setPadding(pad, pad, pad, pad);
|
batteryDrawable.setPadding(pad, pad, pad, pad);
|
||||||
|
|
||||||
@@ -107,6 +107,8 @@ public class BluetoothDeviceLayerDrawable extends LayerDrawable {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static class BatteryMeterDrawable extends BatteryMeterDrawableBase {
|
static class BatteryMeterDrawable extends BatteryMeterDrawableBase {
|
||||||
private final float mAspectRatio;
|
private final float mAspectRatio;
|
||||||
|
@VisibleForTesting
|
||||||
|
int mFrameColor;
|
||||||
|
|
||||||
public BatteryMeterDrawable(Context context, int frameColor, int batteryLevel) {
|
public BatteryMeterDrawable(Context context, int frameColor, int batteryLevel) {
|
||||||
super(context, frameColor);
|
super(context, frameColor);
|
||||||
@@ -118,6 +120,7 @@ public class BluetoothDeviceLayerDrawable extends LayerDrawable {
|
|||||||
final int tintColor = Utils.getColorAttr(context, android.R.attr.colorControlNormal);
|
final int tintColor = Utils.getColorAttr(context, android.R.attr.colorControlNormal);
|
||||||
setColorFilter(new PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_IN));
|
setColorFilter(new PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_IN));
|
||||||
setBatteryLevel(batteryLevel);
|
setBatteryLevel(batteryLevel);
|
||||||
|
mFrameColor = frameColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -100,4 +100,15 @@ public class BluetoothDeviceLayerDrawableTest {
|
|||||||
assertThat(twinDrawable.getLayerInsetTop(1)).isEqualTo(
|
assertThat(twinDrawable.getLayerInsetTop(1)).isEqualTo(
|
||||||
drawable.getLayerInsetTop(1));
|
drawable.getLayerInsetTop(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateLayerDrawable_bluetoothDrawable_hasCorrectFrameColor() {
|
||||||
|
BluetoothDeviceLayerDrawable drawable = BluetoothDeviceLayerDrawable.createLayerDrawable(
|
||||||
|
mContext, RES_ID, BATTERY_LEVEL);
|
||||||
|
BluetoothDeviceLayerDrawable.BatteryMeterDrawable batteryMeterDrawable =
|
||||||
|
(BluetoothDeviceLayerDrawable.BatteryMeterDrawable) drawable.getDrawable(1);
|
||||||
|
|
||||||
|
assertThat(batteryMeterDrawable.mFrameColor).isEqualTo(
|
||||||
|
mContext.getColor(R.color.meter_background_color));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user