Revamp battery Ui in low battery mode
This cl refine battery icon ui in low battery mode: 1. Should show indicator(fixed in ag/2035178) 2. Show bolt icon when charging 3. When battery is low, set battery background as red and indicator as white. This cl also includes the field updates for battery. Bug: 36862496 Test: RunSettingsRoboTests Change-Id: Ifb2ed339742119bbff78712df09288b895756b1f
This commit is contained in:
@@ -511,7 +511,7 @@ public class BatteryHistoryChart extends View {
|
||||
elapsedRealtimeUs);
|
||||
mDrainString = "";
|
||||
mChargeDurationString = "";
|
||||
setContentDescription(mInfo.mChargeLabelString);
|
||||
setContentDescription(mInfo.chargeLabelString);
|
||||
|
||||
int pos = 0;
|
||||
int lastInteresting = 0;
|
||||
@@ -589,7 +589,7 @@ public class BatteryHistoryChart extends View {
|
||||
mMaxPercentLabelStringWidth = (int)mTextPaint.measureText(mMaxPercentLabelString);
|
||||
mMinPercentLabelStringWidth = (int)mTextPaint.measureText(mMinPercentLabelString);
|
||||
mDrainStringWidth = (int)mHeaderTextPaint.measureText(mDrainString);
|
||||
mChargeLabelStringWidth = (int)mHeaderTextPaint.measureText(mInfo.mChargeLabelString);
|
||||
mChargeLabelStringWidth = (int)mHeaderTextPaint.measureText(mInfo.chargeLabelString);
|
||||
mChargeDurationStringWidth = (int)mHeaderTextPaint.measureText(mChargeDurationString);
|
||||
mTextAscent = (int)mTextPaint.ascent();
|
||||
mTextDescent = (int)mTextPaint.descent();
|
||||
@@ -974,7 +974,7 @@ public class BatteryHistoryChart extends View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
mStats.finishIteratingHistoryLocked();
|
||||
@@ -983,9 +983,9 @@ public class BatteryHistoryChart extends View {
|
||||
if (lastY < 0 || lastX < 0) {
|
||||
// Didn't get any data...
|
||||
x = lastX = mLevelLeft;
|
||||
y = lastY = mLevelTop + levelh - ((mInfo.mBatteryLevel-batLow)*(levelh-1))/batChange;
|
||||
y = lastY = mLevelTop + levelh - ((mInfo.batteryLevel -batLow)*(levelh-1))/batChange;
|
||||
Path path;
|
||||
byte value = (byte)mInfo.mBatteryLevel;
|
||||
byte value = (byte)mInfo.batteryLevel;
|
||||
if (value <= mBatteryCriticalLevel) path = mBatCriticalPath;
|
||||
else if (value <= mBatteryWarnLevel) path = mBatWarnPath;
|
||||
else path = null; //mBatGoodPath;
|
||||
@@ -1014,7 +1014,7 @@ public class BatteryHistoryChart extends View {
|
||||
mTimeRemainPath.moveTo(x, lastY);
|
||||
int fullY = mLevelTop + levelh - ((100-batLow)*(levelh-1))/batChange;
|
||||
int emptyY = mLevelTop + levelh - ((0-batLow)*(levelh-1))/batChange;
|
||||
if (mInfo.mDischarging) {
|
||||
if (mInfo.discharging) {
|
||||
mTimeRemainPath.lineTo(mLevelRight, emptyY);
|
||||
} else {
|
||||
mTimeRemainPath.lineTo(mLevelRight, fullY);
|
||||
@@ -1211,8 +1211,8 @@ public class BatteryHistoryChart extends View {
|
||||
|
||||
int headerTop = -mHeaderTextAscent + (mHeaderTextDescent-mHeaderTextAscent)/3;
|
||||
mHeaderTextPaint.setTextAlign(textAlignLeft);
|
||||
if (DEBUG) Log.d(TAG, "Drawing charge label string: " + mInfo.mChargeLabelString);
|
||||
canvas.drawText(mInfo.mChargeLabelString, textStartX, headerTop, mHeaderTextPaint);
|
||||
if (DEBUG) Log.d(TAG, "Drawing charge label string: " + mInfo.chargeLabelString);
|
||||
canvas.drawText(mInfo.chargeLabelString, textStartX, headerTop, mHeaderTextPaint);
|
||||
int stringHalfWidth = mChargeDurationStringWidth / 2;
|
||||
if (layoutRtl) stringHalfWidth = -stringHalfWidth;
|
||||
int headerCenter = ((width-mChargeDurationStringWidth-mDrainStringWidth)/2)
|
||||
|
||||
Reference in New Issue
Block a user