Loading core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -3933,7 +3933,7 @@ M5,17.5 V12 H3 L7,4.5 V10 h2 L5,17.5 z </string> <string name="config_batterymeterPowersavePath" translatable="false"> M9,10l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0l0,2l2,0l0,-2l2,0z M9.75,10l-2.5,0l0,-2.5l-2.5,0l0,2.5l-2.5,0l0,2.5l2.5,0l0,2.5l2.5,0l0,-2.5l2.5,0z </string> <!-- A dual tone battery meter draws the perimeter path twice - once to define the shape Loading packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt +15 −9 Original line number Diff line number Diff line Loading @@ -129,6 +129,14 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) p.style = Paint.Style.FILL_AND_STROKE } private val errorPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = Utils.getColorErrorDefaultColor(context) p.alpha = 255 p.isDither = true p.strokeWidth = 0f p.style = Paint.Style.FILL_AND_STROKE } // Only used if dualTone is set to true private val dualToneBackgroundFill = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = frameColor Loading Loading @@ -179,7 +187,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) // The perimeter should never change unifiedPath.addPath(scaledPerimeter) // IF drawing dual tone, the level is used only to clip the whole drawable path // If drawing dual tone, the level is used only to clip the whole drawable path if (!dualTone) { unifiedPath.op(levelPath, Path.Op.UNION) } Loading @@ -196,9 +204,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) } else if (powerSaveEnabled) { // Clip out the plus shape unifiedPath.op(scaledPlus, Path.Op.DIFFERENCE) if (!invertFillIcon) { c.drawPath(scaledPlus, fillPaint) } c.drawPath(scaledPlus, errorPaint) } if (dualTone) { Loading Loading @@ -235,14 +241,14 @@ 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(scaledPerimeter, errorPaint) // But always put path protection around the plus sign c.clipOutPath(scaledPlus) if (invertFillIcon) { c.drawPath(scaledPlus, fillColorStrokePaint) } else { c.drawPath(scaledPlus, fillColorStrokeProtection) } } } private fun batteryColorForLevel(level: Int): Int { return when { Loading Loading
core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -3933,7 +3933,7 @@ M5,17.5 V12 H3 L7,4.5 V10 h2 L5,17.5 z </string> <string name="config_batterymeterPowersavePath" translatable="false"> M9,10l-2,0l0,-2l-2,0l0,2l-2,0l0,2l2,0l0,2l2,0l0,-2l2,0z M9.75,10l-2.5,0l0,-2.5l-2.5,0l0,2.5l-2.5,0l0,2.5l2.5,0l0,2.5l2.5,0l0,-2.5l2.5,0z </string> <!-- A dual tone battery meter draws the perimeter path twice - once to define the shape Loading
packages/SettingsLib/src/com/android/settingslib/graph/ThemedBatteryDrawable.kt +15 −9 Original line number Diff line number Diff line Loading @@ -129,6 +129,14 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) p.style = Paint.Style.FILL_AND_STROKE } private val errorPaint = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = Utils.getColorErrorDefaultColor(context) p.alpha = 255 p.isDither = true p.strokeWidth = 0f p.style = Paint.Style.FILL_AND_STROKE } // Only used if dualTone is set to true private val dualToneBackgroundFill = Paint(Paint.ANTI_ALIAS_FLAG).also { p -> p.color = frameColor Loading Loading @@ -179,7 +187,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) // The perimeter should never change unifiedPath.addPath(scaledPerimeter) // IF drawing dual tone, the level is used only to clip the whole drawable path // If drawing dual tone, the level is used only to clip the whole drawable path if (!dualTone) { unifiedPath.op(levelPath, Path.Op.UNION) } Loading @@ -196,9 +204,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int) } else if (powerSaveEnabled) { // Clip out the plus shape unifiedPath.op(scaledPlus, Path.Op.DIFFERENCE) if (!invertFillIcon) { c.drawPath(scaledPlus, fillPaint) } c.drawPath(scaledPlus, errorPaint) } if (dualTone) { Loading Loading @@ -235,14 +241,14 @@ 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(scaledPerimeter, errorPaint) // But always put path protection around the plus sign c.clipOutPath(scaledPlus) if (invertFillIcon) { c.drawPath(scaledPlus, fillColorStrokePaint) } else { c.drawPath(scaledPlus, fillColorStrokeProtection) } } } private fun batteryColorForLevel(level: Int): Int { return when { Loading