Horis %!s(int64=2) %!d(string=hai) anos
pai
achega
b66f0c740c
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      app/src/main/java/io/legado/app/ui/widget/BatteryView.kt

+ 5 - 3
app/src/main/java/io/legado/app/ui/widget/BatteryView.kt

@@ -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) {
     override fun onDraw(canvas: Canvas) {
-        if (canvas.isHardwareAccelerated) {
-            canvasRecorder.invalidate()
-        }
         canvasRecorder.recordIfNeededThenDraw(canvas, width, height) {
         canvasRecorder.recordIfNeededThenDraw(canvas, width, height) {
             super.onDraw(this)
             super.onDraw(this)
             if (!isBattery) return@recordIfNeededThenDraw
             if (!isBattery) return@recordIfNeededThenDraw