Simplify battery bar geometry settings

This commit is contained in:
ajp_anton
2026-06-22 01:11:02 +00:00
parent 3bfcb14079
commit b0270b8ceb
12 changed files with 234 additions and 322 deletions
@@ -12,8 +12,10 @@ import android.graphics.Path;
import android.graphics.PathMeasure; import android.graphics.PathMeasure;
import android.graphics.PixelFormat; import android.graphics.PixelFormat;
import android.graphics.Rect; import android.graphics.Rect;
import android.graphics.RectF;
import android.os.BatteryManager; import android.os.BatteryManager;
import android.view.Gravity; import android.view.Gravity;
import android.view.RoundedCorner;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent; import android.view.ViewParent;
@@ -1015,7 +1017,6 @@ final class BatteryBarController {
private final Path fullCurvePath = new Path(); private final Path fullCurvePath = new Path();
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 final float[] pathPoint = new float[2];
private ViewGroup host; private ViewGroup host;
private SbtSettings settings; private SbtSettings settings;
private BatteryBarGeometry geometry; private BatteryBarGeometry geometry;
@@ -1064,6 +1065,17 @@ final class BatteryBarController {
: BatteryBarGeometry.global(settings); : BatteryBarGeometry.global(settings);
int thickness = Math.max(1, dpToPx(getContext(), activeGeometry.thicknessDp)); int thickness = Math.max(1, dpToPx(getContext(), activeGeometry.thicknessDp));
int edgeOffset = Math.max(0, dpToPx(getContext(), settings.batteryBarEdgeOffsetDp)); int edgeOffset = Math.max(0, dpToPx(getContext(), settings.batteryBarEdgeOffsetDp));
float fraction = resolveFraction(batteryLevel, settings);
if (shouldDrawCurvedTop(activeGeometry)) {
buildCurvedPath(
width,
height,
thickness,
edgeOffset,
fraction,
activeGeometry.alignment);
return;
}
int left = edgeOffset; int left = edgeOffset;
int right = width - edgeOffset; int right = width - edgeOffset;
if (right <= left) { if (right <= left) {
@@ -1074,11 +1086,6 @@ final class BatteryBarController {
if (bottom <= top) { if (bottom <= top) {
return; return;
} }
float fraction = resolveFraction(batteryLevel, settings);
if (shouldDrawCurvedTop(activeGeometry)) {
buildCurvedPath(left, right, height, thickness, fraction, activeGeometry.alignment);
return;
}
int availableWidth = right - left; int availableWidth = right - left;
int barWidth = Math.round(availableWidth * fraction); int barWidth = Math.round(availableWidth * fraction);
if (barWidth <= 0) { if (barWidth <= 0) {
@@ -1100,53 +1107,47 @@ final class BatteryBarController {
return false; return false;
} }
return !SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_OFF.equals( return !SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_OFF.equals(
settings.batteryBarCurvedGeometryMode); geometry.curvedGeometryMode);
} }
private void buildCurvedPath( private void buildCurvedPath(
int left, int width,
int right,
int height, int height,
int thickness, int thickness,
int edgeOffset,
float fraction, float fraction,
String alignment String alignment
) { ) {
if (fraction <= 0f || right <= left || height <= 0 || thickness <= 0) { if (fraction <= 0f || width <= 0 || height <= 0 || thickness <= 0) {
return; return;
} }
float halfStroke = thickness / 2f; buildFullCurvePath(width, height, thickness);
float leftCenter = left + halfStroke;
float rightCenter = right - halfStroke;
if (rightCenter <= leftCenter) {
return;
}
buildFullCurvePath(leftCenter, rightCenter, height, thickness);
pathMeasure.setPath(fullCurvePath, false); pathMeasure.setPath(fullCurvePath, false);
float fullLength = pathMeasure.getLength(); float fullLength = pathMeasure.getLength();
if (fullLength <= 0f) { if (fullLength <= 0f) {
return; return;
} }
float targetLength = SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_LENGTH.equals( float pathOffset = Math.min(Math.max(0f, edgeOffset), fullLength / 2f);
settings.batteryBarCurvedGeometryMode) float usableStart = pathOffset;
? fullLength * fraction float usableEnd = fullLength - pathOffset;
: targetDistanceForHorizontalFraction( float usableLength = usableEnd - usableStart;
leftCenter, if (usableLength <= 0f) {
rightCenter, return;
fullLength, }
fraction); float targetLength = usableLength * fraction;
if (targetLength <= 0f) { if (targetLength <= 0f) {
return; return;
} }
targetLength = Math.min(fullLength, targetLength); targetLength = Math.min(usableLength, targetLength);
float start = 0f; float start = usableStart;
float end = targetLength; float end = usableStart + targetLength;
if ("rtl".equals(alignment)) { if ("rtl".equals(alignment)) {
start = fullLength - targetLength; start = usableEnd - targetLength;
end = fullLength; end = usableEnd;
} else if ("center".equals(alignment)) { } else if ("center".equals(alignment)) {
float center = fullLength / 2f; float center = (usableStart + usableEnd) / 2f;
start = Math.max(0f, center - targetLength / 2f); start = Math.max(usableStart, center - targetLength / 2f);
end = Math.min(fullLength, center + targetLength / 2f); end = Math.min(usableEnd, center + targetLength / 2f);
} }
if (end <= start) { if (end <= start) {
return; return;
@@ -1156,64 +1157,103 @@ final class BatteryBarController {
pathStrokeWidth = thickness; pathStrokeWidth = thickness;
} }
private void buildFullCurvePath(float left, float right, int height, int thickness) { private void buildFullCurvePath(int width, int height, int thickness) {
fullCurvePath.reset(); fullCurvePath.reset();
float halfStroke = thickness / 2f; float halfStroke = thickness / 2f;
if (width <= thickness) {
return;
}
float topY = halfStroke; float topY = halfStroke;
float bottomY = Math.max(topY, height - halfStroke); float bottomY = Math.max(topY, height - halfStroke);
float verticalSpan = bottomY - topY; float verticalSpan = bottomY - topY;
float radius = Math.min(verticalSpan, (right - left) / 2f); float outerRadius = Math.min(
fullCurvePath.moveTo(left, bottomY); resolveTopCornerRadius(verticalSpan + halfStroke),
if (radius <= 0f) { width / 2f);
fullCurvePath.lineTo(right, topY); float curveRadius = outerRadius - halfStroke;
if (curveRadius <= 0f) {
buildSharpTopPath(width, topY, bottomY, halfStroke);
return; return;
} }
fullCurvePath.lineTo(left, topY + radius); float leftTopX = outerRadius;
fullCurvePath.quadTo(left, topY, left + radius, topY); float rightTopX = width - outerRadius;
fullCurvePath.lineTo(right - radius, topY); if (rightTopX <= leftTopX) {
fullCurvePath.quadTo(right, topY, right, topY + radius); buildSharpTopPath(width, topY, bottomY, halfStroke);
fullCurvePath.lineTo(right, bottomY); return;
}
RectF leftCorner = new RectF(
halfStroke,
halfStroke,
outerRadius + curveRadius,
outerRadius + curveRadius);
RectF rightCorner = new RectF(
width - outerRadius - curveRadius,
halfStroke,
width - halfStroke,
outerRadius + curveRadius);
float leftStartAngle = leftCornerStartAngle(bottomY, outerRadius, curveRadius);
float leftStartX = cornerX(leftCorner.centerX(), curveRadius, leftStartAngle);
float leftStartY = cornerY(leftCorner.centerY(), curveRadius, leftStartAngle);
fullCurvePath.moveTo(halfStroke, bottomY);
fullCurvePath.lineTo(leftStartX, leftStartY);
fullCurvePath.arcTo(leftCorner, leftStartAngle, 270f - leftStartAngle);
fullCurvePath.lineTo(rightTopX, topY);
float rightEndAngle = rightCornerEndAngle(bottomY, outerRadius, curveRadius);
fullCurvePath.arcTo(rightCorner, 270f, rightEndAngle - 270f);
fullCurvePath.lineTo(width - halfStroke, bottomY);
} }
private float targetDistanceForHorizontalFraction( private float resolveTopCornerRadius(float fallback) {
float left, WindowInsets insets = getRootWindowInsets();
float right, if (insets == null) {
float fullLength, return fallback;
float fraction
) {
if (fraction >= 1f) {
return fullLength;
} }
float horizontalSpan = right - left; int leftRadius = roundedCornerRadius(insets, RoundedCorner.POSITION_TOP_LEFT);
if (horizontalSpan <= 0f) { int rightRadius = roundedCornerRadius(insets, RoundedCorner.POSITION_TOP_RIGHT);
return fullLength * fraction; if (leftRadius > 0 && rightRadius > 0) {
return Math.min(leftRadius, rightRadius);
} }
float targetHorizontal = horizontalSpan * fraction; if (leftRadius > 0 || rightRadius > 0) {
if (targetHorizontal <= 0f) { return Math.max(leftRadius, rightRadius);
return 0f;
} }
int steps = Math.max(32, Math.min(512, Math.round(fullLength / 2f))); return 0f;
float previousDistance = 0f; }
float previousX = left;
float accumulatedHorizontal = 0f; private int roundedCornerRadius(WindowInsets insets, int position) {
for (int step = 1; step <= steps; step++) { RoundedCorner corner = insets.getRoundedCorner(position);
float distance = fullLength * step / steps; return corner != null ? Math.max(0, corner.getRadius()) : 0;
if (!pathMeasure.getPosTan(distance, pathPoint, null)) { }
continue;
} private void buildSharpTopPath(int width, float topY, float bottomY, float halfStroke) {
float dx = Math.abs(pathPoint[0] - previousX); fullCurvePath.moveTo(halfStroke, bottomY);
if (accumulatedHorizontal + dx >= targetHorizontal) { fullCurvePath.lineTo(halfStroke, topY);
if (dx <= 0f) { fullCurvePath.lineTo(width - halfStroke, topY);
return distance; fullCurvePath.lineTo(width - halfStroke, bottomY);
} }
float ratio = (targetHorizontal - accumulatedHorizontal) / dx;
return previousDistance + (distance - previousDistance) * ratio; private float leftCornerStartAngle(float bottomY, float outerRadius, float curveRadius) {
} if (bottomY >= outerRadius) {
accumulatedHorizontal += dx; return 180f;
previousDistance = distance;
previousX = pathPoint[0];
} }
return fullLength; float ratio = Math.max(-1f, Math.min(1f, (outerRadius - bottomY) / curveRadius));
return 180f + (float) Math.toDegrees(Math.asin(ratio));
}
private float rightCornerEndAngle(float bottomY, float outerRadius, float curveRadius) {
if (bottomY >= outerRadius) {
return 360f;
}
float ratio = Math.max(-1f, Math.min(1f, (outerRadius - bottomY) / curveRadius));
return 360f - (float) Math.toDegrees(Math.asin(ratio));
}
private float cornerX(float centerX, float radius, float angleDegrees) {
return centerX + radius * (float) Math.cos(Math.toRadians(angleDegrees));
}
private float cornerY(float centerY, float radius, float angleDegrees) {
return centerY + radius * (float) Math.sin(Math.toRadians(angleDegrees));
} }
private int resolveTop(BatteryBarGeometry geometry, int thickness, int height) { private int resolveTop(BatteryBarGeometry geometry, int thickness, int height) {
@@ -417,7 +417,7 @@ public final class AppIconRules {
continue; continue;
} }
String[] parts = entry.split("\\|", -1); String[] parts = entry.split("\\|", -1);
if (parts.length != 2 && parts.length != 4) { if (parts.length != 4) {
continue; continue;
} }
String pkg = parts[0]; String pkg = parts[0];
@@ -429,13 +429,8 @@ public final class AppIconRules {
int lastSeenOffsetMinutes; int lastSeenOffsetMinutes;
try { try {
firstSeen = Long.parseLong(parts[1]); firstSeen = Long.parseLong(parts[1]);
if (parts.length == 4) { lastSeen = Long.parseLong(parts[2]);
lastSeen = Long.parseLong(parts[2]); lastSeenOffsetMinutes = Integer.parseInt(parts[3]);
lastSeenOffsetMinutes = Integer.parseInt(parts[3]);
} else {
lastSeen = firstSeen;
lastSeenOffsetMinutes = currentTimezoneOffsetMinutes();
}
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
continue; continue;
} }
@@ -21,11 +21,21 @@ public final class BatteryBarGeometry {
public final String position; public final String position;
public final String alignment; public final String alignment;
public final int thicknessDp; public final int thicknessDp;
public final String curvedGeometryMode;
public BatteryBarGeometry( public BatteryBarGeometry(
String position, String position,
String alignment, String alignment,
int thicknessDp int thicknessDp
) {
this(position, alignment, thicknessDp, SbtDefaults.BATTERY_BAR_CURVED_GEOMETRY_MODE_DEFAULT);
}
public BatteryBarGeometry(
String position,
String alignment,
int thicknessDp,
String curvedGeometryMode
) { ) {
this.position = sanitizePosition(position); this.position = sanitizePosition(position);
this.alignment = sanitizeAlignment(alignment); this.alignment = sanitizeAlignment(alignment);
@@ -33,6 +43,7 @@ public final class BatteryBarGeometry {
thicknessDp, thicknessDp,
SbtDefaults.BATTERY_BAR_THICKNESS_DP_MIN, SbtDefaults.BATTERY_BAR_THICKNESS_DP_MIN,
SbtDefaults.BATTERY_BAR_THICKNESS_DP_MAX); SbtDefaults.BATTERY_BAR_THICKNESS_DP_MAX);
this.curvedGeometryMode = sanitizeCurvedGeometryMode(curvedGeometryMode);
} }
public static BatteryBarGeometry global(SbtSettings settings) { public static BatteryBarGeometry global(SbtSettings settings) {
@@ -45,7 +56,8 @@ public final class BatteryBarGeometry {
return new BatteryBarGeometry( return new BatteryBarGeometry(
settings.batteryBarPosition, settings.batteryBarPosition,
settings.batteryBarAlignment, settings.batteryBarAlignment,
settings.batteryBarThicknessDp); settings.batteryBarThicknessDp,
settings.batteryBarCurvedGeometryMode);
} }
public static BatteryBarGeometry resolve( public static BatteryBarGeometry resolve(
@@ -68,17 +80,18 @@ public final class BatteryBarGeometry {
return safeFallback; return safeFallback;
} }
String[] parts = value.split("\\|", -1); String[] parts = value.split("\\|", -1);
if (parts.length != 3 && parts.length != 4) { if (parts.length != 4) {
return safeFallback; return safeFallback;
} }
return new BatteryBarGeometry( return new BatteryBarGeometry(
parts[0], parts[0],
parts[1], parts[1],
parseInt(parts[2], safeFallback.thicknessDp)); parseInt(parts[2], safeFallback.thicknessDp),
parts[3]);
} }
public String encode() { public String encode() {
return position + "|" + alignment + "|" + thicknessDp; return position + "|" + alignment + "|" + thicknessDp + "|" + curvedGeometryMode;
} }
public String signature() { public String signature() {
@@ -104,6 +117,13 @@ public final class BatteryBarGeometry {
return "ltr"; return "ltr";
} }
private static String sanitizeCurvedGeometryMode(String mode) {
if ("length".equals(mode)) {
return "length";
}
return "off";
}
private static int parseInt(String value, int fallback) { private static int parseInt(String value, int fallback) {
try { try {
return Integer.parseInt(value); return Integer.parseInt(value);
@@ -84,7 +84,6 @@ public final class SbtSettings {
public static final String KEY_BATTERY_BAR_DEFAULT_CHARGE_COLOR = "battery_bar_default_charge_color"; public static final String KEY_BATTERY_BAR_DEFAULT_CHARGE_COLOR = "battery_bar_default_charge_color";
public static final String KEY_BATTERY_BAR_THRESHOLDS = "battery_bar_thresholds"; public static final String KEY_BATTERY_BAR_THRESHOLDS = "battery_bar_thresholds";
public static final String BATTERY_BAR_CURVED_GEOMETRY_OFF = "off"; public static final String BATTERY_BAR_CURVED_GEOMETRY_OFF = "off";
public static final String BATTERY_BAR_CURVED_GEOMETRY_HORIZONTAL = "horizontal";
public static final String BATTERY_BAR_CURVED_GEOMETRY_LENGTH = "length"; public static final String BATTERY_BAR_CURVED_GEOMETRY_LENGTH = "length";
public static final String KEY_CLOCK_ENABLED = "clock_enabled"; public static final String KEY_CLOCK_ENABLED = "clock_enabled";
public static final String KEY_CLOCK_ENABLED_LOCKSCREEN = "clock_enabled_lockscreen"; public static final String KEY_CLOCK_ENABLED_LOCKSCREEN = "clock_enabled_lockscreen";
@@ -173,7 +172,6 @@ public final class SbtSettings {
public static final String KEY_LAYOUT_STATUS_VERTICAL_OFFSET_PX = "layout_status_vertical_offset_px"; public static final String KEY_LAYOUT_STATUS_VERTICAL_OFFSET_PX = "layout_status_vertical_offset_px";
public static final String KEY_LAYOUT_STATUS_ICON_HEIGHT_STEPS = "layout_status_icon_height_steps"; public static final String KEY_LAYOUT_STATUS_ICON_HEIGHT_STEPS = "layout_status_icon_height_steps";
public static final String KEY_SYSTEM_ICON_BLOCKED_MODES = SystemIconRules.PREF_KEY_BLOCKED_MODES; public static final String KEY_SYSTEM_ICON_BLOCKED_MODES = SystemIconRules.PREF_KEY_BLOCKED_MODES;
public static final String KEY_SYSTEM_ICON_HIDE_SLOTS = "system_icon_hide_slots";
public static final String KEY_SYSTEM_ICON_DUAL_SIM_SIGNAL_MODE = "system_icon_dual_sim_signal_mode"; public static final String KEY_SYSTEM_ICON_DUAL_SIM_SIGNAL_MODE = "system_icon_dual_sim_signal_mode";
public static final String SYSTEM_ICON_DUAL_SIM_SEPARATE = "separate"; public static final String SYSTEM_ICON_DUAL_SIM_SEPARATE = "separate";
public static final String SYSTEM_ICON_DUAL_SIM_FIRST = "first"; public static final String SYSTEM_ICON_DUAL_SIM_FIRST = "first";
@@ -1017,8 +1015,7 @@ public final class SbtSettings {
} }
public static String readBatteryBarCurvedGeometryMode(String mode) { public static String readBatteryBarCurvedGeometryMode(String mode) {
if (BATTERY_BAR_CURVED_GEOMETRY_HORIZONTAL.equals(mode) if (BATTERY_BAR_CURVED_GEOMETRY_LENGTH.equals(mode)) {
|| BATTERY_BAR_CURVED_GEOMETRY_LENGTH.equals(mode)) {
return mode; return mode;
} }
return BATTERY_BAR_CURVED_GEOMETRY_OFF; return BATTERY_BAR_CURVED_GEOMETRY_OFF;
@@ -1316,9 +1313,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
prefs, prefs,
KEY_LAYOUT_NOTIF_UNLOCKED_COUNT, KEY_LAYOUT_NOTIF_UNLOCKED_COUNT,
KEY_LAYOUT_NOTIF_ENABLED_UNLOCKED, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_ENABLED_UNLOCKED_DEFAULT),
readStringArrayFromPrefs( readStringArrayFromPrefs(
prefs, prefs,
SbtSettings::layoutNotifPositionKey, SbtSettings::layoutNotifPositionKey,
@@ -1334,9 +1329,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
prefs, prefs,
KEY_LAYOUT_NOTIF_LOCK_COUNT, KEY_LAYOUT_NOTIF_LOCK_COUNT,
KEY_LAYOUT_NOTIF_ENABLED_LOCKSCREEN, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_ENABLED_LOCKSCREEN_DEFAULT),
readStringArrayFromPrefs( readStringArrayFromPrefs(
prefs, prefs,
SbtSettings::layoutLockNotifPositionKey, SbtSettings::layoutLockNotifPositionKey,
@@ -1352,9 +1345,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
prefs, prefs,
KEY_LAYOUT_NOTIF_AOD_COUNT, KEY_LAYOUT_NOTIF_AOD_COUNT,
KEY_LAYOUT_NOTIF_ENABLED_AOD, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_ENABLED_AOD_DEFAULT),
readStringArrayFromPrefs( readStringArrayFromPrefs(
prefs, prefs,
SbtSettings::layoutAodNotifPositionKey, SbtSettings::layoutAodNotifPositionKey,
@@ -1391,9 +1382,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
prefs, prefs,
KEY_LAYOUT_STATUS_UNLOCKED_COUNT, KEY_LAYOUT_STATUS_UNLOCKED_COUNT,
KEY_LAYOUT_STATUS_ENABLED_UNLOCKED, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_STATUS_ENABLED_UNLOCKED_DEFAULT),
readStringArrayFromPrefs( readStringArrayFromPrefs(
prefs, prefs,
SbtSettings::layoutStatusPositionKey, SbtSettings::layoutStatusPositionKey,
@@ -1409,9 +1398,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
prefs, prefs,
KEY_LAYOUT_STATUS_LOCK_COUNT, KEY_LAYOUT_STATUS_LOCK_COUNT,
KEY_LAYOUT_STATUS_ENABLED_LOCKSCREEN, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_STATUS_ENABLED_LOCKSCREEN_DEFAULT),
readStringArrayFromPrefs( readStringArrayFromPrefs(
prefs, prefs,
SbtSettings::layoutLockStatusPositionKey, SbtSettings::layoutLockStatusPositionKey,
@@ -1427,9 +1414,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
prefs, prefs,
KEY_LAYOUT_STATUS_AOD_COUNT, KEY_LAYOUT_STATUS_AOD_COUNT,
KEY_LAYOUT_STATUS_ENABLED_AOD, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_STATUS_ENABLED_AOD_DEFAULT),
readStringArrayFromPrefs( readStringArrayFromPrefs(
prefs, prefs,
SbtSettings::layoutAodStatusPositionKey, SbtSettings::layoutAodStatusPositionKey,
@@ -1635,9 +1620,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
bundle, bundle,
KEY_LAYOUT_NOTIF_UNLOCKED_COUNT, KEY_LAYOUT_NOTIF_UNLOCKED_COUNT,
KEY_LAYOUT_NOTIF_ENABLED_UNLOCKED, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_ENABLED_UNLOCKED_DEFAULT),
readStringArrayFromBundle( readStringArrayFromBundle(
bundle, bundle,
SbtSettings::layoutNotifPositionKey, SbtSettings::layoutNotifPositionKey,
@@ -1653,9 +1636,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
bundle, bundle,
KEY_LAYOUT_NOTIF_LOCK_COUNT, KEY_LAYOUT_NOTIF_LOCK_COUNT,
KEY_LAYOUT_NOTIF_ENABLED_LOCKSCREEN, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_ENABLED_LOCKSCREEN_DEFAULT),
readStringArrayFromBundle( readStringArrayFromBundle(
bundle, bundle,
SbtSettings::layoutLockNotifPositionKey, SbtSettings::layoutLockNotifPositionKey,
@@ -1671,9 +1652,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
bundle, bundle,
KEY_LAYOUT_NOTIF_AOD_COUNT, KEY_LAYOUT_NOTIF_AOD_COUNT,
KEY_LAYOUT_NOTIF_ENABLED_AOD, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_ENABLED_AOD_DEFAULT),
readStringArrayFromBundle( readStringArrayFromBundle(
bundle, bundle,
SbtSettings::layoutAodNotifPositionKey, SbtSettings::layoutAodNotifPositionKey,
@@ -1710,9 +1689,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
bundle, bundle,
KEY_LAYOUT_STATUS_UNLOCKED_COUNT, KEY_LAYOUT_STATUS_UNLOCKED_COUNT,
KEY_LAYOUT_STATUS_ENABLED_UNLOCKED, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_STATUS_ENABLED_UNLOCKED_DEFAULT),
readStringArrayFromBundle( readStringArrayFromBundle(
bundle, bundle,
SbtSettings::layoutStatusPositionKey, SbtSettings::layoutStatusPositionKey,
@@ -1728,9 +1705,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
bundle, bundle,
KEY_LAYOUT_STATUS_LOCK_COUNT, KEY_LAYOUT_STATUS_LOCK_COUNT,
KEY_LAYOUT_STATUS_ENABLED_LOCKSCREEN, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_STATUS_ENABLED_LOCKSCREEN_DEFAULT),
readStringArrayFromBundle( readStringArrayFromBundle(
bundle, bundle,
SbtSettings::layoutLockStatusPositionKey, SbtSettings::layoutLockStatusPositionKey,
@@ -1746,9 +1721,7 @@ public final class SbtSettings {
readIconContainerCount( readIconContainerCount(
bundle, bundle,
KEY_LAYOUT_STATUS_AOD_COUNT, KEY_LAYOUT_STATUS_AOD_COUNT,
KEY_LAYOUT_STATUS_ENABLED_AOD, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT),
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtDefaults.LAYOUT_STATUS_ENABLED_AOD_DEFAULT),
readStringArrayFromBundle( readStringArrayFromBundle(
bundle, bundle,
SbtSettings::layoutAodStatusPositionKey, SbtSettings::layoutAodStatusPositionKey,
@@ -1822,35 +1795,21 @@ public final class SbtSettings {
private static int readIconContainerCount( private static int readIconContainerCount(
SharedPreferences prefs, SharedPreferences prefs,
String countKey, String countKey,
String legacyEnabledKey, int defaultCount
int defaultCount,
boolean legacyEnabledDefault
) { ) {
int fallback = iconContainerCountFallback( int value = prefs.getInt(countKey, defaultCount);
prefs.getBoolean(legacyEnabledKey, legacyEnabledDefault),
defaultCount);
int value = prefs.getInt(countKey, fallback);
return clampIconContainerCount(value); return clampIconContainerCount(value);
} }
private static int readIconContainerCount( private static int readIconContainerCount(
Bundle bundle, Bundle bundle,
String countKey, String countKey,
String legacyEnabledKey, int defaultCount
int defaultCount,
boolean legacyEnabledDefault
) { ) {
int fallback = iconContainerCountFallback( int value = bundle.getInt(countKey, defaultCount);
bundle.getBoolean(legacyEnabledKey, legacyEnabledDefault),
defaultCount);
int value = bundle.getInt(countKey, fallback);
return clampIconContainerCount(value); return clampIconContainerCount(value);
} }
private static int iconContainerCountFallback(boolean legacyEnabled, int defaultCount) {
return legacyEnabled ? defaultCount : 0;
}
private static String[] readStringArrayFromPrefs( private static String[] readStringArrayFromPrefs(
SharedPreferences prefs, SharedPreferences prefs,
IndexedKey key, IndexedKey key,
@@ -2035,9 +1994,7 @@ public final class SbtSettings {
} }
Map<String, Integer> parsed = SystemIconRules.parseBlockedModes( Map<String, Integer> parsed = SystemIconRules.parseBlockedModes(
readStringSetFromPrefs(prefs, KEY_SYSTEM_ICON_BLOCKED_MODES)); readStringSetFromPrefs(prefs, KEY_SYSTEM_ICON_BLOCKED_MODES));
HashMap<String, Integer> merged = new HashMap<>(parsed); return parsed.isEmpty() ? Collections.emptyMap() : parsed;
mergeLegacySystemIconHidden(merged, readStringSetFromPrefs(prefs, KEY_SYSTEM_ICON_HIDE_SLOTS));
return merged.isEmpty() ? Collections.emptyMap() : merged;
} }
private static Map<String, Integer> readSystemIconBlockedModesFromBundle(Bundle bundle) { private static Map<String, Integer> readSystemIconBlockedModesFromBundle(Bundle bundle) {
@@ -2046,20 +2003,7 @@ public final class SbtSettings {
} }
Map<String, Integer> parsed = SystemIconRules.parseBlockedModes( Map<String, Integer> parsed = SystemIconRules.parseBlockedModes(
readStringSetFromBundle(bundle, KEY_SYSTEM_ICON_BLOCKED_MODES)); readStringSetFromBundle(bundle, KEY_SYSTEM_ICON_BLOCKED_MODES));
HashMap<String, Integer> merged = new HashMap<>(parsed); return parsed.isEmpty() ? Collections.emptyMap() : parsed;
mergeLegacySystemIconHidden(merged, readStringSetFromBundle(bundle, KEY_SYSTEM_ICON_HIDE_SLOTS));
return merged.isEmpty() ? Collections.emptyMap() : merged;
}
private static void mergeLegacySystemIconHidden(HashMap<String, Integer> merged, Set<String> legacyHidden) {
if (merged == null || legacyHidden == null || legacyHidden.isEmpty()) {
return;
}
for (String slot : legacyHidden) {
SystemIconRules.setModeBlocked(merged, slot,
SystemIconRules.MODE_AOD | SystemIconRules.MODE_LOCK | SystemIconRules.MODE_UNLOCK,
true);
}
} }
public static void ensureReadable(Context context) { public static void ensureReadable(Context context) {
@@ -261,11 +261,7 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.LAYOUT_NOTIF_ENABLED_UNLOCKED_DEFAULT)); SbtDefaults.LAYOUT_NOTIF_ENABLED_UNLOCKED_DEFAULT));
out.putInt(SbtSettings.KEY_LAYOUT_NOTIF_UNLOCKED_COUNT, out.putInt(SbtSettings.KEY_LAYOUT_NOTIF_UNLOCKED_COUNT,
prefs.getInt(SbtSettings.KEY_LAYOUT_NOTIF_UNLOCKED_COUNT, prefs.getInt(SbtSettings.KEY_LAYOUT_NOTIF_UNLOCKED_COUNT,
prefs.getBoolean( SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT));
SbtSettings.KEY_LAYOUT_NOTIF_ENABLED_UNLOCKED,
SbtDefaults.LAYOUT_NOTIF_ENABLED_UNLOCKED_DEFAULT)
? SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT
: 0));
out.putString(SbtSettings.KEY_LAYOUT_NOTIF_MIDDLE_SIDE, out.putString(SbtSettings.KEY_LAYOUT_NOTIF_MIDDLE_SIDE,
prefs.getString(SbtSettings.KEY_LAYOUT_NOTIF_MIDDLE_SIDE, prefs.getString(SbtSettings.KEY_LAYOUT_NOTIF_MIDDLE_SIDE,
SbtDefaults.LAYOUT_NOTIF_MIDDLE_SIDE_DEFAULT)); SbtDefaults.LAYOUT_NOTIF_MIDDLE_SIDE_DEFAULT));
@@ -286,11 +282,7 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.LAYOUT_NOTIF_VERTICAL_OFFSET_PX_DEFAULT); SbtDefaults.LAYOUT_NOTIF_VERTICAL_OFFSET_PX_DEFAULT);
out.putInt(SbtSettings.KEY_LAYOUT_NOTIF_LOCK_COUNT, out.putInt(SbtSettings.KEY_LAYOUT_NOTIF_LOCK_COUNT,
prefs.getInt(SbtSettings.KEY_LAYOUT_NOTIF_LOCK_COUNT, prefs.getInt(SbtSettings.KEY_LAYOUT_NOTIF_LOCK_COUNT,
prefs.getBoolean( SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT));
SbtSettings.KEY_LAYOUT_NOTIF_ENABLED_LOCKSCREEN,
SbtDefaults.LAYOUT_NOTIF_ENABLED_LOCKSCREEN_DEFAULT)
? SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT
: 0));
out.putInt(SbtSettings.layoutLockNotifIconHeightKey(), out.putInt(SbtSettings.layoutLockNotifIconHeightKey(),
prefs.getInt(SbtSettings.layoutLockNotifIconHeightKey(), prefs.getInt(SbtSettings.layoutLockNotifIconHeightKey(),
SbtDefaults.LAYOUT_NOTIF_LOCK_ICON_HEIGHT_STEPS_DEFAULT)); SbtDefaults.LAYOUT_NOTIF_LOCK_ICON_HEIGHT_STEPS_DEFAULT));
@@ -305,11 +297,7 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.LAYOUT_NOTIF_VERTICAL_OFFSET_PX_DEFAULT); SbtDefaults.LAYOUT_NOTIF_VERTICAL_OFFSET_PX_DEFAULT);
out.putInt(SbtSettings.KEY_LAYOUT_NOTIF_AOD_COUNT, out.putInt(SbtSettings.KEY_LAYOUT_NOTIF_AOD_COUNT,
prefs.getInt(SbtSettings.KEY_LAYOUT_NOTIF_AOD_COUNT, prefs.getInt(SbtSettings.KEY_LAYOUT_NOTIF_AOD_COUNT,
prefs.getBoolean( SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT));
SbtSettings.KEY_LAYOUT_NOTIF_ENABLED_AOD,
SbtDefaults.LAYOUT_NOTIF_ENABLED_AOD_DEFAULT)
? SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT
: 0));
out.putInt(SbtSettings.layoutAodNotifIconHeightKey(), out.putInt(SbtSettings.layoutAodNotifIconHeightKey(),
prefs.getInt(SbtSettings.layoutAodNotifIconHeightKey(), prefs.getInt(SbtSettings.layoutAodNotifIconHeightKey(),
SbtDefaults.LAYOUT_NOTIF_AOD_ICON_HEIGHT_STEPS_DEFAULT)); SbtDefaults.LAYOUT_NOTIF_AOD_ICON_HEIGHT_STEPS_DEFAULT));
@@ -336,11 +324,7 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.LAYOUT_STATUS_ENABLED_UNLOCKED_DEFAULT)); SbtDefaults.LAYOUT_STATUS_ENABLED_UNLOCKED_DEFAULT));
out.putInt(SbtSettings.KEY_LAYOUT_STATUS_UNLOCKED_COUNT, out.putInt(SbtSettings.KEY_LAYOUT_STATUS_UNLOCKED_COUNT,
prefs.getInt(SbtSettings.KEY_LAYOUT_STATUS_UNLOCKED_COUNT, prefs.getInt(SbtSettings.KEY_LAYOUT_STATUS_UNLOCKED_COUNT,
prefs.getBoolean( SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT));
SbtSettings.KEY_LAYOUT_STATUS_ENABLED_UNLOCKED,
SbtDefaults.LAYOUT_STATUS_ENABLED_UNLOCKED_DEFAULT)
? SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT
: 0));
out.putString(SbtSettings.KEY_LAYOUT_STATUS_MIDDLE_SIDE, out.putString(SbtSettings.KEY_LAYOUT_STATUS_MIDDLE_SIDE,
prefs.getString(SbtSettings.KEY_LAYOUT_STATUS_MIDDLE_SIDE, prefs.getString(SbtSettings.KEY_LAYOUT_STATUS_MIDDLE_SIDE,
SbtDefaults.LAYOUT_STATUS_MIDDLE_SIDE_DEFAULT)); SbtDefaults.LAYOUT_STATUS_MIDDLE_SIDE_DEFAULT));
@@ -365,11 +349,7 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.SYSTEM_ICON_DUAL_SIM_SIGNAL_MODE_DEFAULT))); SbtDefaults.SYSTEM_ICON_DUAL_SIM_SIGNAL_MODE_DEFAULT)));
out.putInt(SbtSettings.KEY_LAYOUT_STATUS_LOCK_COUNT, out.putInt(SbtSettings.KEY_LAYOUT_STATUS_LOCK_COUNT,
prefs.getInt(SbtSettings.KEY_LAYOUT_STATUS_LOCK_COUNT, prefs.getInt(SbtSettings.KEY_LAYOUT_STATUS_LOCK_COUNT,
prefs.getBoolean( SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT));
SbtSettings.KEY_LAYOUT_STATUS_ENABLED_LOCKSCREEN,
SbtDefaults.LAYOUT_STATUS_ENABLED_LOCKSCREEN_DEFAULT)
? SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT
: 0));
out.putInt(SbtSettings.layoutLockStatusIconHeightKey(), out.putInt(SbtSettings.layoutLockStatusIconHeightKey(),
prefs.getInt(SbtSettings.layoutLockStatusIconHeightKey(), prefs.getInt(SbtSettings.layoutLockStatusIconHeightKey(),
SbtDefaults.LAYOUT_STATUS_ICON_HEIGHT_STEPS_DEFAULT)); SbtDefaults.LAYOUT_STATUS_ICON_HEIGHT_STEPS_DEFAULT));
@@ -384,11 +364,7 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT); SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT);
out.putInt(SbtSettings.KEY_LAYOUT_STATUS_AOD_COUNT, out.putInt(SbtSettings.KEY_LAYOUT_STATUS_AOD_COUNT,
prefs.getInt(SbtSettings.KEY_LAYOUT_STATUS_AOD_COUNT, prefs.getInt(SbtSettings.KEY_LAYOUT_STATUS_AOD_COUNT,
prefs.getBoolean( SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT));
SbtSettings.KEY_LAYOUT_STATUS_ENABLED_AOD,
SbtDefaults.LAYOUT_STATUS_ENABLED_AOD_DEFAULT)
? SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT
: 0));
out.putInt(SbtSettings.layoutAodStatusIconHeightKey(), out.putInt(SbtSettings.layoutAodStatusIconHeightKey(),
prefs.getInt(SbtSettings.layoutAodStatusIconHeightKey(), prefs.getInt(SbtSettings.layoutAodStatusIconHeightKey(),
SbtDefaults.LAYOUT_STATUS_ICON_HEIGHT_STEPS_DEFAULT)); SbtDefaults.LAYOUT_STATUS_ICON_HEIGHT_STEPS_DEFAULT));
@@ -403,7 +379,6 @@ public class SbtSettingsProvider extends ContentProvider {
SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT); SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT);
putStringSetArrayList(out, prefs, SbtSettings.KEY_CLOCK_CAMERA_TYPE_OVERRIDES); putStringSetArrayList(out, prefs, SbtSettings.KEY_CLOCK_CAMERA_TYPE_OVERRIDES);
putStringSetArrayList(out, prefs, SbtSettings.KEY_SYSTEM_ICON_BLOCKED_MODES); putStringSetArrayList(out, prefs, SbtSettings.KEY_SYSTEM_ICON_BLOCKED_MODES);
putStringSetArrayList(out, prefs, SbtSettings.KEY_SYSTEM_ICON_HIDE_SLOTS);
out.putBoolean(SbtSettings.KEY_STATUS_CHIPS_HIDE_ALL, out.putBoolean(SbtSettings.KEY_STATUS_CHIPS_HIDE_ALL,
prefs.getBoolean(SbtSettings.KEY_STATUS_CHIPS_HIDE_ALL, false)); prefs.getBoolean(SbtSettings.KEY_STATUS_CHIPS_HIDE_ALL, false));
out.putBoolean(SbtSettings.KEY_STATUS_CHIPS_HIDE_MEDIA_UNLOCKED, out.putBoolean(SbtSettings.KEY_STATUS_CHIPS_HIDE_MEDIA_UNLOCKED,
@@ -56,6 +56,7 @@ public final class BatteryBarFragment extends Fragment {
.getSharedPreferences(SbtSettings.PREFS_NAME, Context.MODE_PRIVATE); .getSharedPreferences(SbtSettings.PREFS_NAME, Context.MODE_PRIVATE);
SwitchMaterial enabled = root.findViewById(R.id.battery_bar_enabled_switch); SwitchMaterial enabled = root.findViewById(R.id.battery_bar_enabled_switch);
RadioButton positionFollow = root.findViewById(R.id.battery_bar_curved_geometry_length);
RadioButton positionTop = root.findViewById(R.id.battery_bar_position_top); RadioButton positionTop = root.findViewById(R.id.battery_bar_position_top);
RadioButton positionBottom = root.findViewById(R.id.battery_bar_position_bottom); RadioButton positionBottom = root.findViewById(R.id.battery_bar_position_bottom);
RadioGroup positionGroup = root.findViewById(R.id.battery_bar_position_group); RadioGroup positionGroup = root.findViewById(R.id.battery_bar_position_group);
@@ -71,11 +72,6 @@ public final class BatteryBarFragment extends Fragment {
EditText edgeOffsetInput = root.findViewById(R.id.battery_bar_edge_offset_input); EditText edgeOffsetInput = root.findViewById(R.id.battery_bar_edge_offset_input);
MaterialButton edgeOffsetMinus = root.findViewById(R.id.battery_bar_edge_offset_minus); MaterialButton edgeOffsetMinus = root.findViewById(R.id.battery_bar_edge_offset_minus);
MaterialButton edgeOffsetPlus = root.findViewById(R.id.battery_bar_edge_offset_plus); MaterialButton edgeOffsetPlus = root.findViewById(R.id.battery_bar_edge_offset_plus);
RadioGroup curvedGeometryGroup = root.findViewById(R.id.battery_bar_curved_geometry_group);
RadioButton curvedGeometryOff = root.findViewById(R.id.battery_bar_curved_geometry_off);
RadioButton curvedGeometryHorizontal =
root.findViewById(R.id.battery_bar_curved_geometry_horizontal);
RadioButton curvedGeometryLength = root.findViewById(R.id.battery_bar_curved_geometry_length);
MaterialButton minLevelMinus = root.findViewById(R.id.battery_bar_min_level_minus); MaterialButton minLevelMinus = root.findViewById(R.id.battery_bar_min_level_minus);
MaterialButton minLevelPlus = root.findViewById(R.id.battery_bar_min_level_plus); MaterialButton minLevelPlus = root.findViewById(R.id.battery_bar_min_level_plus);
MaterialButton maxLevelMinus = root.findViewById(R.id.battery_bar_max_level_minus); MaterialButton maxLevelMinus = root.findViewById(R.id.battery_bar_max_level_minus);
@@ -105,11 +101,15 @@ public final class BatteryBarFragment extends Fragment {
SbtSettings.KEY_BATTERY_BAR_ENABLED, SbtSettings.KEY_BATTERY_BAR_ENABLED,
SbtDefaults.BATTERY_BAR_ENABLED_DEFAULT)); SbtDefaults.BATTERY_BAR_ENABLED_DEFAULT));
applyPositionSelection( applyPositionSelection(
positionFollow,
positionTop, positionTop,
positionBottom, positionBottom,
prefs.getString( prefs.getString(
SbtSettings.KEY_BATTERY_BAR_POSITION, SbtSettings.KEY_BATTERY_BAR_POSITION,
SbtDefaults.BATTERY_BAR_POSITION_DEFAULT)); SbtDefaults.BATTERY_BAR_POSITION_DEFAULT),
prefs.getString(
SbtSettings.KEY_BATTERY_BAR_CURVED_GEOMETRY_MODE,
SbtDefaults.BATTERY_BAR_CURVED_GEOMETRY_MODE_DEFAULT));
applyAlignmentSelection( applyAlignmentSelection(
alignLtr, alignLtr,
alignRtl, alignRtl,
@@ -123,13 +123,6 @@ public final class BatteryBarFragment extends Fragment {
setIntInput(edgeOffsetInput, prefs.getInt( setIntInput(edgeOffsetInput, prefs.getInt(
SbtSettings.KEY_BATTERY_BAR_EDGE_OFFSET_DP, SbtSettings.KEY_BATTERY_BAR_EDGE_OFFSET_DP,
SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_DEFAULT)); SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_DEFAULT));
applyCurvedGeometrySelection(
curvedGeometryOff,
curvedGeometryHorizontal,
curvedGeometryLength,
prefs.getString(
SbtSettings.KEY_BATTERY_BAR_CURVED_GEOMETRY_MODE,
SbtDefaults.BATTERY_BAR_CURVED_GEOMETRY_MODE_DEFAULT));
setMapping( setMapping(
prefs.getInt(SbtSettings.KEY_BATTERY_BAR_MIN_LEVEL, SbtDefaults.BATTERY_BAR_MIN_LEVEL_DEFAULT), prefs.getInt(SbtSettings.KEY_BATTERY_BAR_MIN_LEVEL, SbtDefaults.BATTERY_BAR_MIN_LEVEL_DEFAULT),
prefs.getInt(SbtSettings.KEY_BATTERY_BAR_MAX_LEVEL, SbtDefaults.BATTERY_BAR_MAX_LEVEL_DEFAULT), prefs.getInt(SbtSettings.KEY_BATTERY_BAR_MAX_LEVEL, SbtDefaults.BATTERY_BAR_MAX_LEVEL_DEFAULT),
@@ -167,6 +160,9 @@ public final class BatteryBarFragment extends Fragment {
positionGroup.setOnCheckedChangeListener((group, checkedId) -> { positionGroup.setOnCheckedChangeListener((group, checkedId) -> {
prefs.edit() prefs.edit()
.putString(SbtSettings.KEY_BATTERY_BAR_POSITION, positionValue(checkedId)) .putString(SbtSettings.KEY_BATTERY_BAR_POSITION, positionValue(checkedId))
.putString(
SbtSettings.KEY_BATTERY_BAR_CURVED_GEOMETRY_MODE,
curvedGeometryValue(checkedId))
.apply(); .apply();
SbtSettings.ensureReadable(requireContext()); SbtSettings.ensureReadable(requireContext());
}); });
@@ -196,16 +192,6 @@ public final class BatteryBarFragment extends Fragment {
SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_MIN, SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_MIN,
SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_MAX, SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_MAX,
SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_DEFAULT); SbtDefaults.BATTERY_BAR_EDGE_OFFSET_DP_DEFAULT);
if (curvedGeometryGroup != null) {
curvedGeometryGroup.setOnCheckedChangeListener((group, checkedId) -> {
prefs.edit()
.putString(
SbtSettings.KEY_BATTERY_BAR_CURVED_GEOMETRY_MODE,
curvedGeometryValue(checkedId))
.apply();
SbtSettings.ensureReadable(requireContext());
});
}
renderScenarioOverrides(scenarioOverridesContainer, prefs); renderScenarioOverrides(scenarioOverridesContainer, prefs);
setSectionEnabled(geometrySection, enabled.isChecked()); setSectionEnabled(geometrySection, enabled.isChecked());
@@ -634,7 +620,7 @@ public final class BatteryBarFragment extends Fragment {
if (summary != null) { if (summary != null) {
summary.setText(getString( summary.setText(getString(
R.string.battery_bar_override_summary, R.string.battery_bar_override_summary,
geometry.position, batteryBarPositionLabel(geometry),
geometry.alignment, geometry.alignment,
geometry.thicknessDp)); geometry.thicknessDp));
summary.setAlpha(enabled ? 1f : 0.65f); summary.setAlpha(enabled ? 1f : 0.65f);
@@ -666,7 +652,10 @@ public final class BatteryBarFragment extends Fragment {
SbtDefaults.BATTERY_BAR_ALIGNMENT_DEFAULT), SbtDefaults.BATTERY_BAR_ALIGNMENT_DEFAULT),
prefs.getInt( prefs.getInt(
SbtSettings.KEY_BATTERY_BAR_THICKNESS_DP, SbtSettings.KEY_BATTERY_BAR_THICKNESS_DP,
SbtDefaults.BATTERY_BAR_THICKNESS_DP_DEFAULT)); SbtDefaults.BATTERY_BAR_THICKNESS_DP_DEFAULT),
prefs.getString(
SbtSettings.KEY_BATTERY_BAR_CURVED_GEOMETRY_MODE,
SbtDefaults.BATTERY_BAR_CURVED_GEOMETRY_MODE_DEFAULT));
} }
private BatteryBarGeometry scenarioGeometryFromPrefs( private BatteryBarGeometry scenarioGeometryFromPrefs(
@@ -708,11 +697,17 @@ public final class BatteryBarFragment extends Fragment {
TextView positionTitle = dialogLabel(R.string.battery_bar_position_title); TextView positionTitle = dialogLabel(R.string.battery_bar_position_title);
content.addView(positionTitle); content.addView(positionTitle);
RadioGroup positionGroup = new RadioGroup(requireContext()); RadioGroup positionGroup = new RadioGroup(requireContext());
RadioButton positionFollow = dialogRadio(R.string.battery_bar_curved_geometry_length);
RadioButton positionTop = dialogRadio(R.string.battery_bar_position_top); RadioButton positionTop = dialogRadio(R.string.battery_bar_position_top);
RadioButton positionBottom = dialogRadio(R.string.battery_bar_position_bottom); RadioButton positionBottom = dialogRadio(R.string.battery_bar_position_bottom);
positionFollow.setId(R.id.battery_bar_curved_geometry_length);
positionTop.setId(R.id.battery_bar_position_top);
positionBottom.setId(R.id.battery_bar_position_bottom);
positionGroup.addView(positionFollow);
positionGroup.addView(positionTop); positionGroup.addView(positionTop);
positionGroup.addView(positionBottom); positionGroup.addView(positionBottom);
applyPositionSelection(positionTop, positionBottom, current.position); applyPositionSelection(positionFollow, positionTop, positionBottom,
current.position, current.curvedGeometryMode);
content.addView(positionGroup); content.addView(positionGroup);
TextView alignmentTitle = dialogLabel(R.string.battery_bar_alignment_title); TextView alignmentTitle = dialogLabel(R.string.battery_bar_alignment_title);
@@ -737,15 +732,17 @@ public final class BatteryBarFragment extends Fragment {
.setView(content) .setView(content)
.setNegativeButton(android.R.string.cancel, null) .setNegativeButton(android.R.string.cancel, null)
.setPositiveButton(android.R.string.ok, (dialogInterface, which) -> { .setPositiveButton(android.R.string.ok, (dialogInterface, which) -> {
int checkedPosition = positionGroup.getCheckedRadioButtonId();
BatteryBarGeometry updated = new BatteryBarGeometry( BatteryBarGeometry updated = new BatteryBarGeometry(
positionBottom.isChecked() ? "bottom" : "top", positionValue(checkedPosition),
alignmentRtl.isChecked() alignmentRtl.isChecked()
? "rtl" ? "rtl"
: alignmentCenter.isChecked() ? "center" : "ltr", : alignmentCenter.isChecked() ? "center" : "ltr",
ViewTreeSupport.clamp( ViewTreeSupport.clamp(
ViewTreeSupport.parseInt(thicknessInput, current.thicknessDp), ViewTreeSupport.parseInt(thicknessInput, current.thicknessDp),
SbtDefaults.BATTERY_BAR_THICKNESS_DP_MIN, SbtDefaults.BATTERY_BAR_THICKNESS_DP_MIN,
SbtDefaults.BATTERY_BAR_THICKNESS_DP_MAX)); SbtDefaults.BATTERY_BAR_THICKNESS_DP_MAX),
curvedGeometryValue(checkedPosition));
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
for (BatteryBarGeometry.Scenario scenario : scenarioGroup.scenarios()) { for (BatteryBarGeometry.Scenario scenario : scenarioGroup.scenarios()) {
editor.putString(BatteryBarGeometry.valueKey(scenario), updated.encode()); editor.putString(BatteryBarGeometry.valueKey(scenario), updated.encode());
@@ -1255,14 +1252,23 @@ public final class BatteryBarFragment extends Fragment {
} }
} }
private void applyPositionSelection(RadioButton top, private void applyPositionSelection(RadioButton follow,
RadioButton top,
RadioButton bottom, RadioButton bottom,
String position) { String position,
String curvedGeometryMode) {
boolean bottomSelected = "bottom".equals(position);
boolean followSelected = !bottomSelected
&& SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_LENGTH.equals(
SbtSettings.readBatteryBarCurvedGeometryMode(curvedGeometryMode));
if (follow != null) {
follow.setChecked(followSelected);
}
if (top != null) { if (top != null) {
top.setChecked(!"bottom".equals(position)); top.setChecked(!bottomSelected && !followSelected);
} }
if (bottom != null) { if (bottom != null) {
bottom.setChecked("bottom".equals(position)); bottom.setChecked(bottomSelected);
} }
} }
@@ -1273,29 +1279,19 @@ public final class BatteryBarFragment extends Fragment {
return "top"; return "top";
} }
private void applyCurvedGeometrySelection( private String batteryBarPositionLabel(BatteryBarGeometry geometry) {
RadioButton off, if (geometry != null && "bottom".equals(geometry.position)) {
RadioButton horizontal, return getString(R.string.battery_bar_position_bottom);
RadioButton length,
String mode
) {
String safeMode = SbtSettings.readBatteryBarCurvedGeometryMode(mode);
if (off != null) {
off.setChecked(SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_OFF.equals(safeMode));
} }
if (horizontal != null) { if (geometry != null
horizontal.setChecked( && SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_LENGTH.equals(
SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_HORIZONTAL.equals(safeMode)); geometry.curvedGeometryMode)) {
} return getString(R.string.battery_bar_curved_geometry_length);
if (length != null) {
length.setChecked(SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_LENGTH.equals(safeMode));
} }
return getString(R.string.battery_bar_position_top);
} }
private String curvedGeometryValue(int checkedId) { private String curvedGeometryValue(int checkedId) {
if (checkedId == R.id.battery_bar_curved_geometry_horizontal) {
return SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_HORIZONTAL;
}
if (checkedId == R.id.battery_bar_curved_geometry_length) { if (checkedId == R.id.battery_bar_curved_geometry_length) {
return SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_LENGTH; return SbtSettings.BATTERY_BAR_CURVED_GEOMETRY_LENGTH;
} }
@@ -148,8 +148,6 @@ public final class LayoutFragment extends Fragment {
R.string.layout_notification_position_title, R.string.layout_notification_position_title,
SbtSettings.KEY_LAYOUT_NOTIF_UNLOCKED_COUNT, SbtSettings.KEY_LAYOUT_NOTIF_UNLOCKED_COUNT,
SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT, SbtDefaults.LAYOUT_NOTIF_UNLOCKED_COUNT_DEFAULT,
SbtSettings.KEY_LAYOUT_NOTIF_ENABLED_UNLOCKED,
SbtDefaults.LAYOUT_NOTIF_ENABLED_UNLOCKED_DEFAULT,
SbtSettings::layoutNotifPositionKey, SbtSettings::layoutNotifPositionKey,
SbtSettings::layoutNotifMiddleSideKey, SbtSettings::layoutNotifMiddleSideKey,
SbtSettings::layoutNotifVerticalOffsetKey, SbtSettings::layoutNotifVerticalOffsetKey,
@@ -166,8 +164,6 @@ public final class LayoutFragment extends Fragment {
R.string.layout_status_position_title, R.string.layout_status_position_title,
SbtSettings.KEY_LAYOUT_STATUS_UNLOCKED_COUNT, SbtSettings.KEY_LAYOUT_STATUS_UNLOCKED_COUNT,
SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT, SbtDefaults.LAYOUT_STATUS_UNLOCKED_COUNT_DEFAULT,
SbtSettings.KEY_LAYOUT_STATUS_ENABLED_UNLOCKED,
SbtDefaults.LAYOUT_STATUS_ENABLED_UNLOCKED_DEFAULT,
SbtSettings::layoutStatusPositionKey, SbtSettings::layoutStatusPositionKey,
SbtSettings::layoutStatusMiddleSideKey, SbtSettings::layoutStatusMiddleSideKey,
SbtSettings::layoutStatusVerticalOffsetKey, SbtSettings::layoutStatusVerticalOffsetKey,
@@ -187,8 +183,6 @@ public final class LayoutFragment extends Fragment {
int sectionTitleId, int sectionTitleId,
String countKey, String countKey,
int countDefault, int countDefault,
String legacyEnabledKey,
boolean legacyEnabledDefault,
SbtSettings.IndexedKey positionKey, SbtSettings.IndexedKey positionKey,
SbtSettings.IndexedKey middleSideKey, SbtSettings.IndexedKey middleSideKey,
SbtSettings.IndexedKey verticalOffsetKey, SbtSettings.IndexedKey verticalOffsetKey,
@@ -223,9 +217,7 @@ public final class LayoutFragment extends Fragment {
int count = ViewTreeSupport.iconContainerCount( int count = ViewTreeSupport.iconContainerCount(
prefs, prefs,
countKey, countKey,
legacyEnabledKey, countDefault);
countDefault,
legacyEnabledDefault);
LayoutXmlCardSupport.setIndexedCardTitle(requireContext(), sourceCard, sectionTitleId, 0, count); LayoutXmlCardSupport.setIndexedCardTitle(requireContext(), sourceCard, sectionTitleId, 0, count);
setCompatPadding(sourceCard, count <= 1); setCompatPadding(sourceCard, count <= 1);
boolean cardsMode = LockedNotificationModeUi.MODE_CARDS.equals( boolean cardsMode = LockedNotificationModeUi.MODE_CARDS.equals(
@@ -242,12 +234,11 @@ public final class LayoutFragment extends Fragment {
countContainer.addView(ViewTreeSupport.iconContainerCountControl( countContainer.addView(ViewTreeSupport.iconContainerCountControl(
requireContext(), requireContext(),
count, count,
value -> ViewTreeSupport.persistIconContainerCount( value -> ViewTreeSupport.persistIconContainerCount(
requireContext(), requireContext(),
prefs, prefs,
countKey, countKey,
legacyEnabledKey, value),
value),
() -> { () -> {
if (rebuild[0] != null) { if (rebuild[0] != null) {
rebuild[0].run(); rebuild[0].run();
@@ -173,8 +173,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
R.id.status_vertical_offset_plus_fast, R.id.status_vertical_offset_plus_fast,
R.id.status_vertical_offset_reset, R.id.status_vertical_offset_reset,
R.string.layout_status_position_title, R.string.layout_status_position_title,
aod ? SbtSettings.KEY_LAYOUT_STATUS_ENABLED_AOD : SbtSettings.KEY_LAYOUT_STATUS_ENABLED_LOCKSCREEN,
aod ? SbtDefaults.LAYOUT_STATUS_ENABLED_AOD_DEFAULT : SbtDefaults.LAYOUT_STATUS_ENABLED_LOCKSCREEN_DEFAULT,
SbtDefaults.LAYOUT_STATUS_POSITION_DEFAULT, SbtDefaults.LAYOUT_STATUS_POSITION_DEFAULT,
SbtDefaults.LAYOUT_STATUS_MIDDLE_SIDE_DEFAULT, SbtDefaults.LAYOUT_STATUS_MIDDLE_SIDE_DEFAULT,
SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT, SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT,
@@ -205,8 +203,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
R.id.notif_vertical_offset_plus_fast, R.id.notif_vertical_offset_plus_fast,
R.id.notif_vertical_offset_reset, R.id.notif_vertical_offset_reset,
R.string.layout_notification_position_title, R.string.layout_notification_position_title,
aod ? SbtSettings.KEY_LAYOUT_NOTIF_ENABLED_AOD : SbtSettings.KEY_LAYOUT_NOTIF_ENABLED_LOCKSCREEN,
aod ? SbtDefaults.LAYOUT_NOTIF_ENABLED_AOD_DEFAULT : SbtDefaults.LAYOUT_NOTIF_ENABLED_LOCKSCREEN_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_POSITION_DEFAULT, SbtDefaults.LAYOUT_NOTIF_POSITION_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_MIDDLE_SIDE_DEFAULT, SbtDefaults.LAYOUT_NOTIF_MIDDLE_SIDE_DEFAULT,
SbtDefaults.LAYOUT_NOTIF_VERTICAL_OFFSET_PX_DEFAULT, SbtDefaults.LAYOUT_NOTIF_VERTICAL_OFFSET_PX_DEFAULT,
@@ -305,8 +301,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
int verticalPlusFastId, int verticalPlusFastId,
int verticalResetId, int verticalResetId,
int titleId, int titleId,
String legacyEnabledKey,
boolean legacyEnabledDefault,
String positionDefault, String positionDefault,
String middleSideDefault, String middleSideDefault,
int verticalOffsetDefault, int verticalOffsetDefault,
@@ -324,9 +318,7 @@ abstract class LockedSceneLayoutFragment extends Fragment {
int count = ViewTreeSupport.iconContainerCount( int count = ViewTreeSupport.iconContainerCount(
prefs, prefs,
countKey, countKey,
legacyEnabledKey, 1);
1,
legacyEnabledDefault);
View primary = configuredIconContainerCard( View primary = configuredIconContainerCard(
context, context,
prefs, prefs,
@@ -354,7 +346,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
verticalOffsetDefault, verticalOffsetDefault,
iconHeightKey, iconHeightKey,
iconHeightDefault, iconHeightDefault,
legacyEnabledKey,
countKey, countKey,
count, count,
rebuild[0]); rebuild[0]);
@@ -390,7 +381,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
null, null,
0, 0,
null, null,
null,
count, count,
null); null);
setTopMargin(context, copy, 0); setTopMargin(context, copy, 0);
@@ -452,7 +442,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
int verticalOffsetDefault, int verticalOffsetDefault,
@Nullable String iconHeightKey, @Nullable String iconHeightKey,
int iconHeightDefault, int iconHeightDefault,
@Nullable String legacyEnabledKey,
@Nullable String countKey, @Nullable String countKey,
int count, int count,
@Nullable Runnable onCountChanged @Nullable Runnable onCountChanged
@@ -470,7 +459,6 @@ abstract class LockedSceneLayoutFragment extends Fragment {
context, context,
prefs, prefs,
countKey, countKey,
legacyEnabledKey,
value), value),
onCountChanged), onCountChanged),
insertIndex); insertIndex);
@@ -477,8 +477,6 @@ public class SystemIconsFragment extends Fragment {
Set<String> encoded = SystemIconRules.encodeBlockedModes(blockedModes); Set<String> encoded = SystemIconRules.encodeBlockedModes(blockedModes);
prefs.edit() prefs.edit()
.putStringSet(SbtSettings.KEY_SYSTEM_ICON_BLOCKED_MODES, encoded) .putStringSet(SbtSettings.KEY_SYSTEM_ICON_BLOCKED_MODES, encoded)
// Clear legacy key so migration does not keep re-forcing stale global hides.
.putStringSet(SbtSettings.KEY_SYSTEM_ICON_HIDE_SLOTS, Collections.emptySet())
.apply(); .apply();
SbtSettings.ensureReadable(requireContext()); SbtSettings.ensureReadable(requireContext());
} }
@@ -238,25 +238,20 @@ final class ViewTreeSupport {
static int iconContainerCount( static int iconContainerCount(
SharedPreferences prefs, SharedPreferences prefs,
String countKey, String countKey,
String legacyEnabledKey, int defaultCount
int defaultCount,
boolean legacyEnabledDefault
) { ) {
int fallback = prefs.getBoolean(legacyEnabledKey, legacyEnabledDefault) ? defaultCount : 0; return SbtSettings.clampIconContainerCount(prefs.getInt(countKey, defaultCount));
return SbtSettings.clampIconContainerCount(prefs.getInt(countKey, fallback));
} }
static void persistIconContainerCount( static void persistIconContainerCount(
Context context, Context context,
SharedPreferences prefs, SharedPreferences prefs,
String countKey, String countKey,
String legacyEnabledKey,
int count int count
) { ) {
int clamped = SbtSettings.clampIconContainerCount(count); int clamped = SbtSettings.clampIconContainerCount(count);
prefs.edit() prefs.edit()
.putInt(countKey, clamped) .putInt(countKey, clamped)
.putBoolean(legacyEnabledKey, clamped > 0)
.apply(); .apply();
SbtSettings.ensureReadable(context); SbtSettings.ensureReadable(context);
} }
@@ -84,6 +84,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp"> android:layout_marginTop="8dp">
<RadioButton
android:id="@+id/battery_bar_curved_geometry_length"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="36dp"
android:text="@string/battery_bar_curved_geometry_length" />
<RadioButton <RadioButton
android:id="@+id/battery_bar_position_top" android:id="@+id/battery_bar_position_top"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -183,40 +190,6 @@
android:text="+" /> android:text="+" />
</LinearLayout> </LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/battery_bar_curved_geometry_title"
android:textAppearance="?attr/textAppearanceBody2" />
<RadioGroup
android:id="@+id/battery_bar_curved_geometry_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<RadioButton
android:id="@+id/battery_bar_curved_geometry_off"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="36dp"
android:text="@string/battery_bar_curved_geometry_off" />
<RadioButton
android:id="@+id/battery_bar_curved_geometry_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="36dp"
android:text="@string/battery_bar_curved_geometry_horizontal" />
<RadioButton
android:id="@+id/battery_bar_curved_geometry_length"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="36dp"
android:text="@string/battery_bar_curved_geometry_length" />
</RadioGroup>
</LinearLayout> </LinearLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
+2 -5
View File
@@ -137,7 +137,7 @@
<string name="battery_bar_master_toggle_title">Master toggle</string> <string name="battery_bar_master_toggle_title">Master toggle</string>
<string name="battery_bar_enabled">Enable battery bar</string> <string name="battery_bar_enabled">Enable battery bar</string>
<string name="battery_bar_position_title">Position</string> <string name="battery_bar_position_title">Position</string>
<string name="battery_bar_position_top">Top</string> <string name="battery_bar_position_top">Top edge of screen</string>
<string name="battery_bar_position_bottom">Bottom of status bar</string> <string name="battery_bar_position_bottom">Bottom of status bar</string>
<string name="battery_bar_alignment_title">Alignment</string> <string name="battery_bar_alignment_title">Alignment</string>
<string name="battery_bar_alignment_ltr">&#8594;</string> <string name="battery_bar_alignment_ltr">&#8594;</string>
@@ -145,10 +145,7 @@
<string name="battery_bar_alignment_center">&#8596;</string> <string name="battery_bar_alignment_center">&#8596;</string>
<string name="battery_bar_thickness_title">Thickness (dp)</string> <string name="battery_bar_thickness_title">Thickness (dp)</string>
<string name="battery_bar_edge_offset_title">Edge offset (dp)</string> <string name="battery_bar_edge_offset_title">Edge offset (dp)</string>
<string name="battery_bar_curved_geometry_title">Curved top geometry</string> <string name="battery_bar_curved_geometry_length">Follow screen edges</string>
<string name="battery_bar_curved_geometry_off">Off</string>
<string name="battery_bar_curved_geometry_horizontal">On, horizontal position only</string>
<string name="battery_bar_curved_geometry_length">On, actual curve length</string>
<string name="battery_bar_scenario_overrides_title">Scenario overrides</string> <string name="battery_bar_scenario_overrides_title">Scenario overrides</string>
<string name="battery_bar_scenario_overrides_hint">Optional geometry overrides. Disabled scenarios use the default geometry above.</string> <string name="battery_bar_scenario_overrides_hint">Optional geometry overrides. Disabled scenarios use the default geometry above.</string>
<string name="battery_bar_scenario_group_unlocked">Unlocked</string> <string name="battery_bar_scenario_group_unlocked">Unlocked</string>