diff --git a/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/battery/BatteryBarController.java b/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/battery/BatteryBarController.java index dff09f2..9fa0094 100644 --- a/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/battery/BatteryBarController.java +++ b/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/battery/BatteryBarController.java @@ -434,7 +434,7 @@ final class BatteryBarController { ) { BatteryBarView barView = ensureBatteryBarView(rootGroup); layoutBatteryBarView(rootGroup, barView); - barView.update(rootGroup, settings, geometry, batteryLevel, plugged, color); + barView.update(rootGroup, rootGroup, settings, geometry, batteryLevel, plugged, color); barView.bringToFront(); barView.invalidate(); lastSignatures.put(rootGroup, buildSignature(rootGroup, settings, color, geometry, scenario)); @@ -461,7 +461,7 @@ final class BatteryBarController { return; } pendingOverlayRetries.remove(root); - overlay.view.update(overlay.host, settings, geometry, batteryLevel, plugged, color); + overlay.view.update(overlay.host, root, settings, geometry, batteryLevel, plugged, color); if (!signature.equals(lastOverlaySignatures.get(root))) { overlay.updateLayout(bounds.width, bounds.height); lastOverlaySignatures.put(root, signature); @@ -1039,6 +1039,7 @@ final class BatteryBarController { private final Path drawPath = new Path(); private final PathMeasure pathMeasure = new PathMeasure(); private ViewGroup host; + private View roundedCornerSource; private SbtSettings settings; private BatteryBarGeometry geometry; private int batteryLevel = -1; @@ -1053,6 +1054,7 @@ final class BatteryBarController { void update( ViewGroup host, + View roundedCornerSource, SbtSettings settings, BatteryBarGeometry geometry, int batteryLevel, @@ -1060,6 +1062,7 @@ final class BatteryBarController { int color ) { this.host = host; + this.roundedCornerSource = roundedCornerSource; this.settings = settings; this.geometry = geometry; this.batteryLevel = batteryLevel; @@ -1226,7 +1229,12 @@ final class BatteryBarController { } private float resolveTopCornerRadius(float fallback) { - WindowInsets insets = getRootWindowInsets(); + WindowInsets insets = roundedCornerSource != null + ? roundedCornerSource.getRootWindowInsets() + : null; + if (insets == null) { + insets = getRootWindowInsets(); + } if (insets == null) { return fallback; }