Use statusbar insets for fullscreen battery curves
This commit is contained in:
+11
-3
@@ -434,7 +434,7 @@ final class BatteryBarController {
|
|||||||
) {
|
) {
|
||||||
BatteryBarView barView = ensureBatteryBarView(rootGroup);
|
BatteryBarView barView = ensureBatteryBarView(rootGroup);
|
||||||
layoutBatteryBarView(rootGroup, barView);
|
layoutBatteryBarView(rootGroup, barView);
|
||||||
barView.update(rootGroup, settings, geometry, batteryLevel, plugged, color);
|
barView.update(rootGroup, rootGroup, settings, geometry, batteryLevel, plugged, color);
|
||||||
barView.bringToFront();
|
barView.bringToFront();
|
||||||
barView.invalidate();
|
barView.invalidate();
|
||||||
lastSignatures.put(rootGroup, buildSignature(rootGroup, settings, color, geometry, scenario));
|
lastSignatures.put(rootGroup, buildSignature(rootGroup, settings, color, geometry, scenario));
|
||||||
@@ -461,7 +461,7 @@ final class BatteryBarController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pendingOverlayRetries.remove(root);
|
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))) {
|
if (!signature.equals(lastOverlaySignatures.get(root))) {
|
||||||
overlay.updateLayout(bounds.width, bounds.height);
|
overlay.updateLayout(bounds.width, bounds.height);
|
||||||
lastOverlaySignatures.put(root, signature);
|
lastOverlaySignatures.put(root, signature);
|
||||||
@@ -1039,6 +1039,7 @@ final class BatteryBarController {
|
|||||||
private final Path drawPath = new Path();
|
private final Path drawPath = new Path();
|
||||||
private final PathMeasure pathMeasure = new PathMeasure();
|
private final PathMeasure pathMeasure = new PathMeasure();
|
||||||
private ViewGroup host;
|
private ViewGroup host;
|
||||||
|
private View roundedCornerSource;
|
||||||
private SbtSettings settings;
|
private SbtSettings settings;
|
||||||
private BatteryBarGeometry geometry;
|
private BatteryBarGeometry geometry;
|
||||||
private int batteryLevel = -1;
|
private int batteryLevel = -1;
|
||||||
@@ -1053,6 +1054,7 @@ final class BatteryBarController {
|
|||||||
|
|
||||||
void update(
|
void update(
|
||||||
ViewGroup host,
|
ViewGroup host,
|
||||||
|
View roundedCornerSource,
|
||||||
SbtSettings settings,
|
SbtSettings settings,
|
||||||
BatteryBarGeometry geometry,
|
BatteryBarGeometry geometry,
|
||||||
int batteryLevel,
|
int batteryLevel,
|
||||||
@@ -1060,6 +1062,7 @@ final class BatteryBarController {
|
|||||||
int color
|
int color
|
||||||
) {
|
) {
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
this.roundedCornerSource = roundedCornerSource;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.geometry = geometry;
|
this.geometry = geometry;
|
||||||
this.batteryLevel = batteryLevel;
|
this.batteryLevel = batteryLevel;
|
||||||
@@ -1226,7 +1229,12 @@ final class BatteryBarController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float resolveTopCornerRadius(float fallback) {
|
private float resolveTopCornerRadius(float fallback) {
|
||||||
WindowInsets insets = getRootWindowInsets();
|
WindowInsets insets = roundedCornerSource != null
|
||||||
|
? roundedCornerSource.getRootWindowInsets()
|
||||||
|
: null;
|
||||||
|
if (insets == null) {
|
||||||
|
insets = getRootWindowInsets();
|
||||||
|
}
|
||||||
if (insets == null) {
|
if (insets == null) {
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user