Merge "Battery icon is too large"
This commit is contained in:
@@ -53,8 +53,9 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/bt_battery_icon"
|
android:id="@+id/bt_battery_icon"
|
||||||
android:layout_width="13dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="20dp"/>
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/bt_battery_summary"
|
android:id="@+id/bt_battery_summary"
|
||||||
style="@style/TextAppearance.EntityHeaderSummary"
|
style="@style/TextAppearance.EntityHeaderSummary"
|
||||||
|
@@ -405,4 +405,8 @@
|
|||||||
|
|
||||||
<!-- Header title size of advanced bluetooth device -->
|
<!-- Header title size of advanced bluetooth device -->
|
||||||
<dimen name="advanced_bluetooth_header_title_text_size">16sp</dimen>
|
<dimen name="advanced_bluetooth_header_title_text_size">16sp</dimen>
|
||||||
|
|
||||||
|
<!-- Battery meter icon size of advanced bluetooth device -->
|
||||||
|
<dimen name="advanced_bluetooth_battery_meter_width">7.5dp</dimen>
|
||||||
|
<dimen name="advanced_bluetooth_battery_meter_height">13dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -183,14 +183,18 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
|||||||
Drawable createBtBatteryIcon(Context context, int level, boolean charging) {
|
Drawable createBtBatteryIcon(Context context, int level, boolean charging) {
|
||||||
final BatteryMeterView.BatteryMeterDrawable drawable =
|
final BatteryMeterView.BatteryMeterDrawable drawable =
|
||||||
new BatteryMeterView.BatteryMeterDrawable(context,
|
new BatteryMeterView.BatteryMeterDrawable(context,
|
||||||
context.getColor(R.color.meter_background_color));
|
context.getColor(R.color.meter_background_color),
|
||||||
|
context.getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.advanced_bluetooth_battery_meter_width),
|
||||||
|
context.getResources().getDimensionPixelSize(
|
||||||
|
R.dimen.advanced_bluetooth_battery_meter_height));
|
||||||
drawable.setBatteryLevel(level);
|
drawable.setBatteryLevel(level);
|
||||||
final int attr = level > LOW_BATTERY_LEVEL || charging
|
final int attr = level > LOW_BATTERY_LEVEL || charging
|
||||||
? android.R.attr.colorControlNormal
|
? android.R.attr.colorControlNormal
|
||||||
: android.R.attr.colorError;
|
: android.R.attr.colorError;
|
||||||
drawable.setColorFilter(new PorterDuffColorFilter(
|
drawable.setColorFilter(new PorterDuffColorFilter(
|
||||||
com.android.settings.Utils.getColorAttrDefaultColor(context, attr),
|
com.android.settings.Utils.getColorAttrDefaultColor(context, attr),
|
||||||
PorterDuff.Mode.SRC_IN));
|
PorterDuff.Mode.SRC));
|
||||||
drawable.setCharging(charging);
|
drawable.setCharging(charging);
|
||||||
|
|
||||||
return drawable;
|
return drawable;
|
||||||
|
@@ -117,6 +117,13 @@ public class BatteryMeterView extends ImageView {
|
|||||||
.getDimensionPixelSize(R.dimen.battery_meter_height);
|
.getDimensionPixelSize(R.dimen.battery_meter_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BatteryMeterDrawable(Context context, int frameColor, int width, int height) {
|
||||||
|
super(context, frameColor);
|
||||||
|
|
||||||
|
mIntrinsicWidth = width;
|
||||||
|
mIntrinsicHeight = height;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIntrinsicWidth() {
|
public int getIntrinsicWidth() {
|
||||||
return mIntrinsicWidth;
|
return mIntrinsicWidth;
|
||||||
|
Reference in New Issue
Block a user