Merge "[Rohan]The battery level show up "-1%", not sync with Rohan." into sc-dev am: 6f96226f45
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14045485 Change-Id: Ib71bad87161501a98eec50ca3cbe12544f0c68c5
This commit is contained in:
@@ -289,10 +289,15 @@ public class AdvancedBluetoothDetailsHeaderController extends BasePreferenceCont
|
||||
} else {
|
||||
if (deviceId == MAIN_DEVICE_ID) {
|
||||
linearLayout.setVisibility(View.VISIBLE);
|
||||
batterySummaryView.setText(com.android.settings.Utils.formatPercentage(
|
||||
bluetoothDevice.getBatteryLevel()));
|
||||
batterySummaryView.setVisibility(View.VISIBLE);
|
||||
linearLayout.findViewById(R.id.bt_battery_icon).setVisibility(View.GONE);
|
||||
int level = bluetoothDevice.getBatteryLevel();
|
||||
if (level != BluetoothDevice.BATTERY_LEVEL_UNKNOWN
|
||||
&& level != BluetoothDevice.BATTERY_LEVEL_BLUETOOTH_OFF) {
|
||||
batterySummaryView.setText(com.android.settings.Utils.formatPercentage(level));
|
||||
batterySummaryView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
batterySummaryView.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
// Hide it if it doesn't have battery information
|
||||
linearLayout.setVisibility(View.GONE);
|
||||
|
||||
Reference in New Issue
Block a user