Use statusbar insets for fullscreen battery curves

This commit is contained in:
ajp_anton
2026-06-24 23:31:20 +00:00
parent 2fe90ce3fc
commit 18f1c6f20f
@@ -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;
}