Merge "Add battery estimate to content description." into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0fbcf57edf
@@ -322,9 +322,6 @@ public class BatteryMeterView extends LinearLayout implements
|
|||||||
mCharging = pluggedIn;
|
mCharging = pluggedIn;
|
||||||
mLevel = level;
|
mLevel = level;
|
||||||
updatePercentText();
|
updatePercentText();
|
||||||
setContentDescription(
|
|
||||||
getContext().getString(charging ? R.string.accessibility_battery_level_charging
|
|
||||||
: R.string.accessibility_battery_level, level));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -358,6 +355,9 @@ public class BatteryMeterView extends LinearLayout implements
|
|||||||
mBatteryController.getEstimatedTimeRemainingString((String estimate) -> {
|
mBatteryController.getEstimatedTimeRemainingString((String estimate) -> {
|
||||||
if (estimate != null) {
|
if (estimate != null) {
|
||||||
mBatteryPercentView.setText(estimate);
|
mBatteryPercentView.setText(estimate);
|
||||||
|
setContentDescription(getContext().getString(
|
||||||
|
R.string.battery_low_percent_format_hybrid, mLevel, estimate));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setPercentTextAtCurrentLevel();
|
setPercentTextAtCurrentLevel();
|
||||||
}
|
}
|
||||||
@@ -371,6 +371,9 @@ public class BatteryMeterView extends LinearLayout implements
|
|||||||
private void setPercentTextAtCurrentLevel() {
|
private void setPercentTextAtCurrentLevel() {
|
||||||
mBatteryPercentView.setText(
|
mBatteryPercentView.setText(
|
||||||
NumberFormat.getPercentInstance().format(mLevel / 100f));
|
NumberFormat.getPercentInstance().format(mLevel / 100f));
|
||||||
|
setContentDescription(
|
||||||
|
getContext().getString(mCharging ? R.string.accessibility_battery_level_charging
|
||||||
|
: R.string.accessibility_battery_level, mLevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateShowPercent() {
|
private void updateShowPercent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user