Merge "Update status bar battery icon" into udc-dev

This commit is contained in:
YK Hung
2023-03-13 10:26:22 +00:00
committed by Android (Google) Code Review
3 changed files with 9 additions and 6 deletions

View File

@@ -572,7 +572,7 @@
<!-- BatteryMeterView parameters -->
<array name="batterymeter_color_levels">
<item>15</item>
<item>20</item>
<item>100</item>
</array>
<array name="batterymeter_color_values">

View File

@@ -43,4 +43,6 @@
<color name="qr_focused_corner_line_color">#ff1a73e8</color>
<color name="qr_background_color">#b3ffffff</color> <!-- 70% white transparency -->
<!-- End of QR code scanner colors -->
<color name="batterymeter_saver_color">#FBBC04</color>
</resources>

View File

@@ -135,7 +135,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
}
private val errorPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p ->
p.color = Utils.getColorStateListDefaultColor(context, R.color.batterymeter_plus_color)
p.color = Utils.getColorStateListDefaultColor(context, R.color.batterymeter_saver_color)
p.alpha = 255
p.isDither = true
p.strokeWidth = 0f
@@ -244,10 +244,11 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
c.drawPath(scaledBolt, fillColorStrokeProtection)
}
} else if (powerSaveEnabled) {
// If power save is enabled draw the perimeter path with colorError
c.drawPath(scaledErrorPerimeter, errorPaint)
// If power save is enabled draw the level path with colorError
c.drawPath(levelPath, errorPaint)
// And draw the plus sign on top of the fill
c.drawPath(scaledPlus, errorPaint)
fillPaint.color = fillColor
c.drawPath(scaledPlus, fillPaint)
}
c.restore()
}
@@ -414,7 +415,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
companion object {
const val WIDTH = 12f
const val HEIGHT = 20f
private const val CRITICAL_LEVEL = 15
private const val CRITICAL_LEVEL = 20
// On a 12x20 grid, how wide to make the fill protection stroke.
// Scales when our size changes
private const val PROTECTION_STROKE_WIDTH = 3f