Loading res/layout/advanced_bt_entity_sub.xml +3 −2 Original line number Diff line number Diff line Loading @@ -51,8 +51,9 @@ android:orientation="horizontal"> <ImageView android:id="@+id/bt_battery_icon" android:layout_width="13dp" android:layout_height="20dp"/> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> <TextView android:id="@+id/bt_battery_summary" style="@style/TextAppearance.EntityHeaderSummary" Loading res/values/dimens.xml +7 −0 Original line number Diff line number Diff line Loading @@ -414,4 +414,11 @@ <!-- System navigation settings illustration height --> <dimen name="system_navigation_illustration_height">320dp</dimen> <!-- Header title size of advanced bluetooth device --> <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.8dp</dimen> <dimen name="advanced_bluetooth_battery_meter_height">13dp</dimen> </resources> src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java +11 −4 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import java.util.Map; public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceController implements LifecycleObserver, OnStart, OnStop, OnDestroy, CachedBluetoothDevice.Callback { private static final String TAG = "AdvancedBtHeaderCtrl"; private static final int LOW_BATTERY_LEVEL = 20; @VisibleForTesting LayoutPreference mLayoutPreference; Loading Loading @@ -180,12 +181,18 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont Drawable createBtBatteryIcon(Context context, int level, boolean charging) { final BatteryMeterView.BatteryMeterDrawable drawable = 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); final int attr = level > LOW_BATTERY_LEVEL || charging ? android.R.attr.colorControlNormal : android.R.attr.colorError; drawable.setColorFilter(new PorterDuffColorFilter( com.android.settings.Utils.getColorAttrDefaultColor(context, android.R.attr.colorControlNormal), PorterDuff.Mode.SRC_IN)); com.android.settings.Utils.getColorAttrDefaultColor(context, attr), PorterDuff.Mode.SRC)); drawable.setCharging(charging); return drawable; Loading src/com/android/settings/fuelgauge/BatteryMeterView.java +7 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,13 @@ public class BatteryMeterView extends ImageView { .getDimensionPixelSize(R.dimen.battery_meter_height); } public BatteryMeterDrawable(Context context, int frameColor, int width, int height) { super(context, frameColor); mIntrinsicWidth = width; mIntrinsicHeight = height; } @Override public int getIntrinsicWidth() { return mIntrinsicWidth; Loading Loading
res/layout/advanced_bt_entity_sub.xml +3 −2 Original line number Diff line number Diff line Loading @@ -51,8 +51,9 @@ android:orientation="horizontal"> <ImageView android:id="@+id/bt_battery_icon" android:layout_width="13dp" android:layout_height="20dp"/> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/> <TextView android:id="@+id/bt_battery_summary" style="@style/TextAppearance.EntityHeaderSummary" Loading
res/values/dimens.xml +7 −0 Original line number Diff line number Diff line Loading @@ -414,4 +414,11 @@ <!-- System navigation settings illustration height --> <dimen name="system_navigation_illustration_height">320dp</dimen> <!-- Header title size of advanced bluetooth device --> <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.8dp</dimen> <dimen name="advanced_bluetooth_battery_meter_height">13dp</dimen> </resources>
src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java +11 −4 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ import java.util.Map; public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceController implements LifecycleObserver, OnStart, OnStop, OnDestroy, CachedBluetoothDevice.Callback { private static final String TAG = "AdvancedBtHeaderCtrl"; private static final int LOW_BATTERY_LEVEL = 20; @VisibleForTesting LayoutPreference mLayoutPreference; Loading Loading @@ -180,12 +181,18 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont Drawable createBtBatteryIcon(Context context, int level, boolean charging) { final BatteryMeterView.BatteryMeterDrawable drawable = 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); final int attr = level > LOW_BATTERY_LEVEL || charging ? android.R.attr.colorControlNormal : android.R.attr.colorError; drawable.setColorFilter(new PorterDuffColorFilter( com.android.settings.Utils.getColorAttrDefaultColor(context, android.R.attr.colorControlNormal), PorterDuff.Mode.SRC_IN)); com.android.settings.Utils.getColorAttrDefaultColor(context, attr), PorterDuff.Mode.SRC)); drawable.setCharging(charging); return drawable; Loading
src/com/android/settings/fuelgauge/BatteryMeterView.java +7 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,13 @@ public class BatteryMeterView extends ImageView { .getDimensionPixelSize(R.dimen.battery_meter_height); } public BatteryMeterDrawable(Context context, int frameColor, int width, int height) { super(context, frameColor); mIntrinsicWidth = width; mIntrinsicHeight = height; } @Override public int getIntrinsicWidth() { return mIntrinsicWidth; Loading