This commit is contained in:
Horis 2024-02-22 22:39:35 +08:00
parent 55ed40c4b4
commit 0045a3f98c

View File

@ -74,10 +74,12 @@ class BatteryView @JvmOverloads constructor(
}
}
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
super.onLayout(changed, left, top, right, bottom)
canvasRecorder.invalidate()
}
override fun onDraw(canvas: Canvas) {
if (canvas.isHardwareAccelerated) {
canvasRecorder.invalidate()
}
canvasRecorder.recordIfNeededThenDraw(canvas, width, height) {
super.onDraw(this)
if (!isBattery) return@recordIfNeededThenDraw