Streamline battery bar rendering and cleanup
This commit is contained in:
@@ -9,12 +9,13 @@ public final class SystemUiCapabilities {
|
||||
public static final String PACKAGE_SYSTEM = "system";
|
||||
public static final String PACKAGE_SYSTEMUI = "com.android.systemui";
|
||||
public static final String PACKAGE_SAMSUNG_AOD_SERVICE = "com.samsung.android.app.aodservice";
|
||||
private static final boolean SAMSUNG_ONE_UI = "samsung".equalsIgnoreCase(Build.MANUFACTURER);
|
||||
|
||||
private SystemUiCapabilities() {
|
||||
}
|
||||
|
||||
public static boolean isSamsungOneUi() {
|
||||
return "samsung".equalsIgnoreCase(Build.MANUFACTURER);
|
||||
return SAMSUNG_ONE_UI;
|
||||
}
|
||||
|
||||
public static boolean supportsLockscreenShadeWindowRoot() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package se.ajpanton.statusbartweak.runtime;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
|
||||
@@ -7,6 +8,7 @@ public final class ViewIdNames {
|
||||
private ViewIdNames() {
|
||||
}
|
||||
|
||||
@SuppressLint("ResourceType") // Foreign SystemUI ids are opaque integers, not this app's R.id values.
|
||||
public static String idName(View view) {
|
||||
if (view == null || view.getId() == View.NO_ID || (view.getId() >>> 24) == 0) {
|
||||
return "";
|
||||
|
||||
+62
-56
@@ -59,8 +59,8 @@ final class BatteryBarController {
|
||||
private final Map<View, OverlayBatteryBar> overlayBatteryBars = new WeakHashMap<>();
|
||||
private final Map<View, View.OnLayoutChangeListener> rootLayoutListeners = new WeakHashMap<>();
|
||||
private final Set<View> pendingOverlayRetries = Collections.newSetFromMap(new WeakHashMap<>());
|
||||
private final Map<View, String> lastSignatures = new WeakHashMap<>();
|
||||
private final Map<View, String> lastOverlaySignatures = new WeakHashMap<>();
|
||||
private final Map<View, RenderSignature> lastSignatures = new WeakHashMap<>();
|
||||
private final Map<View, RenderSignature> lastOverlaySignatures = new WeakHashMap<>();
|
||||
private final Map<View, Integer> lastRootTransformSignatures = new WeakHashMap<>();
|
||||
private int systemBarAppearance;
|
||||
private int systemBarBehavior;
|
||||
@@ -87,7 +87,7 @@ final class BatteryBarController {
|
||||
installRootTransformHooks();
|
||||
installSystemBarAttributeListener(classLoader);
|
||||
installTransientBarListener(classLoader);
|
||||
runtimeContext.getModeStateRepository().addSceneListener((previous, current) -> refreshAllRoots());
|
||||
runtimeContext.getModeStateRepository().addSceneListener((previous, current) -> postRefreshAllRoots());
|
||||
hooksInstalled = true;
|
||||
}
|
||||
|
||||
@@ -149,14 +149,6 @@ final class BatteryBarController {
|
||||
}
|
||||
return result;
|
||||
});
|
||||
XposedHookSupport.hookAllMethodsIfExists(framework, View.class, "setY", chain -> {
|
||||
Object result = chain.proceed();
|
||||
Object target = chain.getThisObject();
|
||||
if (target instanceof View root && roots.contains(root)) {
|
||||
applyBatteryBarAfterRootTransform(root);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
XposedHookSupport.hookAllMethodsIfExists(framework, View.class, "setAlpha", chain -> {
|
||||
Object target = chain.getThisObject();
|
||||
Object alphaArg = chain.getArgs() != null && !chain.getArgs().isEmpty()
|
||||
@@ -374,10 +366,6 @@ final class BatteryBarController {
|
||||
}
|
||||
|
||||
private void applyBatteryBar(View root) {
|
||||
applyBatteryBarInternal(root);
|
||||
}
|
||||
|
||||
private void applyBatteryBarInternal(View root) {
|
||||
if (!(root instanceof ViewGroup rootGroup)) {
|
||||
removeBatteryBarView(root);
|
||||
return;
|
||||
@@ -414,15 +402,15 @@ final class BatteryBarController {
|
||||
return;
|
||||
}
|
||||
removeOverlayBatteryBar(root);
|
||||
String signature = buildSignature(root, settings, color, geometry, scenario);
|
||||
RenderSignature signature = RenderSignature.of(
|
||||
root, scenario, batteryLevel, plugged, color, geometry, settings);
|
||||
BatteryBarView existingView = batteryBarViews.get(root);
|
||||
String lastSignature = lastSignatures.get(root);
|
||||
RenderSignature lastSignature = lastSignatures.get(root);
|
||||
if (signature.equals(lastSignature) && existingView != null && existingView.getParent() == rootGroup) {
|
||||
existingView.bringToFront();
|
||||
return;
|
||||
}
|
||||
applyEmbeddedBatteryBar(rootGroup, settings, geometry, scenario, color);
|
||||
lastSignatures.put(root, signature);
|
||||
}
|
||||
|
||||
private void applyEmbeddedBatteryBar(
|
||||
@@ -437,7 +425,9 @@ final class BatteryBarController {
|
||||
barView.update(rootGroup, rootGroup, settings, geometry, batteryLevel, plugged, color);
|
||||
barView.bringToFront();
|
||||
barView.invalidate();
|
||||
lastSignatures.put(rootGroup, buildSignature(rootGroup, settings, color, geometry, scenario));
|
||||
lastSignatures.put(
|
||||
rootGroup,
|
||||
RenderSignature.of(rootGroup, scenario, batteryLevel, plugged, color, geometry, settings));
|
||||
}
|
||||
|
||||
private void applyOverlayBatteryBar(
|
||||
@@ -447,7 +437,8 @@ final class BatteryBarController {
|
||||
BatteryBarGeometry.Scenario scenario,
|
||||
int color
|
||||
) {
|
||||
String signature = buildSignature(root, settings, color, geometry, scenario);
|
||||
RenderSignature signature = RenderSignature.of(
|
||||
root, scenario, batteryLevel, plugged, color, geometry, settings);
|
||||
OverlayBatteryBar overlay = overlayBatteryBars.get(root);
|
||||
if (overlay == null) {
|
||||
overlay = new OverlayBatteryBar(root.getContext());
|
||||
@@ -534,34 +525,6 @@ final class BatteryBarController {
|
||||
);
|
||||
}
|
||||
|
||||
private String buildSignature(
|
||||
View root,
|
||||
SbtSettings settings,
|
||||
int color,
|
||||
BatteryBarGeometry geometry,
|
||||
BatteryBarGeometry.Scenario scenario
|
||||
) {
|
||||
return root.getWidth() + "|"
|
||||
+ root.getHeight() + "|"
|
||||
+ scenario + "|"
|
||||
+ batteryLevel + "|"
|
||||
+ plugged + "|"
|
||||
+ color + "|"
|
||||
+ settings.batteryBarEnabled + "|"
|
||||
+ settings.batteryBarScenarioEnabled + "|"
|
||||
+ settings.batteryBarPosition + "|"
|
||||
+ settings.batteryBarAlignment + "|"
|
||||
+ settings.batteryBarThicknessDp + "|"
|
||||
+ settings.batteryBarEdgeOffsetDp + "|"
|
||||
+ settings.batteryBarCurvedGeometryMode + "|"
|
||||
+ (geometry != null ? geometry.signature() : "") + "|"
|
||||
+ settings.batteryBarMinLevel + "|"
|
||||
+ settings.batteryBarMaxLevel + "|"
|
||||
+ settings.batteryBarDefaultDischargeColor + "|"
|
||||
+ settings.batteryBarDefaultChargeColor + "|"
|
||||
+ BatteryBarStyle.encodeThresholds(settings.batteryBarThresholds);
|
||||
}
|
||||
|
||||
private BatteryBarGeometry.Scenario scenarioForRoot(View root) {
|
||||
if (isKeyguardRoot(root)) {
|
||||
return BatteryBarGeometry.Scenario.LOCKSCREEN;
|
||||
@@ -708,7 +671,15 @@ final class BatteryBarController {
|
||||
}
|
||||
|
||||
private boolean shouldRenderVisibleFullscreenBar(View root) {
|
||||
return root != null && isFullscreenSystemBarState() && statusBarTransientShown;
|
||||
return root != null
|
||||
&& isFullscreenSystemBarState()
|
||||
&& statusBarTransientShown
|
||||
&& isStatusBarWindowVisible(root);
|
||||
}
|
||||
|
||||
private boolean isStatusBarWindowVisible(View root) {
|
||||
WindowInsets insets = root.getRootWindowInsets();
|
||||
return insets == null || insets.isVisible(WindowInsets.Type.statusBars());
|
||||
}
|
||||
|
||||
private void updateTransientBarState(java.util.List<Object> args, boolean visible) {
|
||||
@@ -746,13 +717,7 @@ final class BatteryBarController {
|
||||
}
|
||||
|
||||
private OverlayBounds fullscreenOverlayBounds(View root) {
|
||||
int width = root.getWidth();
|
||||
int height = root.getHeight();
|
||||
Rect bounds = currentWindowBounds(root.getContext());
|
||||
if (bounds.width() > 0) {
|
||||
width = bounds.width();
|
||||
}
|
||||
return new OverlayBounds(width, height);
|
||||
return new OverlayBounds(root.getWidth(), root.getHeight());
|
||||
}
|
||||
|
||||
private static Rect currentWindowBounds(Context context) {
|
||||
@@ -774,6 +739,47 @@ final class BatteryBarController {
|
||||
private record OverlayBounds(int width, int height) {
|
||||
}
|
||||
|
||||
private record RenderSignature(
|
||||
int width,
|
||||
int height,
|
||||
BatteryBarGeometry.Scenario scenario,
|
||||
int batteryLevel,
|
||||
boolean plugged,
|
||||
int color,
|
||||
String position,
|
||||
String alignment,
|
||||
int thicknessDp,
|
||||
int edgeOffsetDp,
|
||||
String curvedGeometryMode,
|
||||
int minLevel,
|
||||
int maxLevel
|
||||
) {
|
||||
static RenderSignature of(
|
||||
View root,
|
||||
BatteryBarGeometry.Scenario scenario,
|
||||
int batteryLevel,
|
||||
boolean plugged,
|
||||
int color,
|
||||
BatteryBarGeometry geometry,
|
||||
SbtSettings settings
|
||||
) {
|
||||
return new RenderSignature(
|
||||
root.getWidth(),
|
||||
root.getHeight(),
|
||||
scenario,
|
||||
batteryLevel,
|
||||
plugged,
|
||||
color,
|
||||
geometry.position,
|
||||
geometry.alignment,
|
||||
geometry.thicknessDp,
|
||||
geometry.edgeOffsetDp,
|
||||
geometry.curvedGeometryMode,
|
||||
settings.batteryBarMinLevel,
|
||||
settings.batteryBarMaxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSystemBarState(java.util.List<Object> args) {
|
||||
if (args == null || args.size() < 2) {
|
||||
return;
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package se.ajpanton.statusbartweak.runtime.hooks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* Replacement for legacy Xposed additional-instance-field helpers.
|
||||
*/
|
||||
public final class InstanceStateStore {
|
||||
|
||||
private final WeakHashMap<Object, Map<String, Object>> state = new WeakHashMap<>();
|
||||
|
||||
public synchronized Object get(Object target, String key) {
|
||||
if (target == null || key == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> fields = state.get(target);
|
||||
return fields != null ? fields.get(key) : null;
|
||||
}
|
||||
|
||||
public synchronized void put(Object target, String key, Object value) {
|
||||
if (target == null || key == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> fields = state.computeIfAbsent(target, ignored -> new HashMap<>());
|
||||
fields.put(key, value);
|
||||
}
|
||||
|
||||
public synchronized void remove(Object target, String key) {
|
||||
if (target == null || key == null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> fields = state.get(target);
|
||||
if (fields == null) {
|
||||
return;
|
||||
}
|
||||
fields.remove(key);
|
||||
if (fields.isEmpty()) {
|
||||
state.remove(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -1,8 +1,11 @@
|
||||
package se.ajpanton.statusbartweak.runtime.layout;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
@@ -3937,10 +3940,15 @@ final class StockLayoutCanvasController {
|
||||
return hasVisibleStatusChipContent(view);
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission") // The SystemUI process owns READ_PHONE_STATE; the explicit check below handles other hosts.
|
||||
private boolean isPhoneCallActive(View view) {
|
||||
if (view == null || view.getContext() == null) {
|
||||
return false;
|
||||
}
|
||||
if (view.getContext().checkSelfPermission(Manifest.permission.READ_PHONE_STATE)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
TelecomManager telecomManager = view.getContext().getSystemService(TelecomManager.class);
|
||||
return telecomManager != null && telecomManager.isInCall();
|
||||
|
||||
@@ -107,10 +107,6 @@ public final class BatteryBarGeometry {
|
||||
return position + "|" + alignment + "|" + thicknessDp + "|" + edgeOffsetDp + "|" + curvedGeometryMode;
|
||||
}
|
||||
|
||||
public String signature() {
|
||||
return encode();
|
||||
}
|
||||
|
||||
public static String enabledKey(Scenario scenario) {
|
||||
return SbtSettings.batteryBarGeometryOverrideEnabledKey(scenario.id);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
android:id="@+id/hidden_item_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:baselineAligned="false"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="56dp"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<color name="sbt_background_top">#FF110B07</color>
|
||||
<color name="sbt_background_bottom">#FF1B0F08</color>
|
||||
<color name="sbt_surface">#FF20140D</color>
|
||||
<color name="sbt_surface_variant">#FF302012</color>
|
||||
<color name="sbt_on_primary">#FFFFFFFF</color>
|
||||
<color name="sbt_on_surface">#FFEAF0F3</color>
|
||||
<color name="sbt_on_surface_variant">#FFE3D3B6</color>
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="Theme.StatusBarTweak" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<item name="colorPrimary">@color/sbt_primary</item>
|
||||
<item name="colorPrimaryVariant">@color/sbt_primary_dark</item>
|
||||
<item name="colorOnPrimary">@color/sbt_on_primary</item>
|
||||
<item name="colorSecondary">@color/sbt_accent</item>
|
||||
<item name="colorSecondaryVariant">@color/sbt_accent_dark</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<item name="colorSurface">@color/sbt_surface</item>
|
||||
<item name="colorOnSurface">@color/sbt_on_surface</item>
|
||||
<item name="android:colorAccent">@color/sbt_accent</item>
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:windowBackground">@drawable/sbt_window_background</item>
|
||||
<item name="android:navigationBarColor">@color/sbt_primary_dark</item>
|
||||
<item name="android:statusBarColor">@color/sbt_primary_dark</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="materialCardViewStyle">@style/Widget.StatusBarTweak.Card</item>
|
||||
<item name="materialButtonOutlinedStyle">@style/Widget.StatusBarTweak.OutlinedButton</item>
|
||||
<item name="materialAlertDialogTheme">@style/ThemeOverlay.StatusBarTweak.MaterialAlertDialog</item>
|
||||
<item name="sliderStyle">@style/Widget.StatusBarTweak.Slider</item>
|
||||
<item name="switchStyle">@style/Widget.StatusBarTweak.Switch</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -8,12 +8,10 @@
|
||||
<color name="sbt_background_top">#FFFFF4E8</color>
|
||||
<color name="sbt_background_bottom">#FFF5E5D2</color>
|
||||
<color name="sbt_surface">#FFFFFFFF</color>
|
||||
<color name="sbt_surface_variant">#FFFFF1E0</color>
|
||||
<color name="sbt_on_primary">#FFFFFFFF</color>
|
||||
<color name="sbt_on_surface">#FF111820</color>
|
||||
<color name="sbt_on_surface_variant">#FF62553F</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="sbt_card_outline">#24000000</color>
|
||||
<color name="sbt_panel_outline">#4D000000</color>
|
||||
<color name="sbt_hidden_item_active_bg">#1AE65100</color>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<string name="nav_layout_lockscreen">    Lockscreen</string>
|
||||
<string name="nav_layout_aod">    AOD</string>
|
||||
<string name="nav_battery_bar">Battery bar</string>
|
||||
<string name="nav_block_app_notification_icons">Hide notification icons</string>
|
||||
<string name="nav_status_chips">Status chips</string>
|
||||
<string name="nav_misc">Misc</string>
|
||||
<string name="debug_title">Debugging</string>
|
||||
@@ -51,7 +50,6 @@
|
||||
<string name="debug_camera_action_undo">↶</string>
|
||||
<string name="debug_camera_other_item">%1$s • %2$s</string>
|
||||
<string name="debug_camera_unknown">unknown</string>
|
||||
<string name="notification_icons_title">Notification icons</string>
|
||||
<string name="system_icons_title">Hide status icons</string>
|
||||
<string name="system_icons_hint">Status-icon rules for the custom layout engine.</string>
|
||||
<string name="system_icons_hide_hint">Icons represent, in order:\nAOD, Lockscreen, Unlocked.</string>
|
||||
@@ -72,43 +70,27 @@
|
||||
<string name="system_icon_bluetooth">Bluetooth</string>
|
||||
<string name="system_icon_data_saver">Data saver</string>
|
||||
<string name="system_icon_do_not_disturb">Do not disturb</string>
|
||||
<string name="system_icon_enhanced_processing">Enhanced processing</string>
|
||||
<string name="system_icon_home_carrier">Homescreen carrier</string>
|
||||
<string name="system_icon_hotspot">Mobile hotspot</string>
|
||||
<string name="system_icon_ims">IMS network icons</string>
|
||||
<string name="system_icon_location">Location</string>
|
||||
<string name="system_icon_lock_carrier">Lockscreen carrier</string>
|
||||
<string name="system_icon_lockscreen_mum">Two phone user icon</string>
|
||||
<string name="system_icon_managed_profile">Managed profile</string>
|
||||
<string name="system_icon_mobile">Mobile data signal</string>
|
||||
<string name="system_icon_modes">Modes</string>
|
||||
<string name="system_icon_nfc">NFC</string>
|
||||
<string name="system_icon_panel_carrier">Expanded panel carrier</string>
|
||||
<string name="system_icon_power_saver">Power saver</string>
|
||||
<string name="system_icon_rcs">RCS</string>
|
||||
<string name="system_icon_two_phone_mode">Two phone mode icon</string>
|
||||
<string name="system_icon_volume">Volume</string>
|
||||
<string name="system_icon_vpn">VPN</string>
|
||||
<string name="system_icon_wifi">Wi-Fi</string>
|
||||
<string name="section_unlocked">Unlocked</string>
|
||||
<string name="section_icons_mode">Icons mode</string>
|
||||
<string name="section_cards_mode">Cards mode</string>
|
||||
<string name="section_aod">AOD</string>
|
||||
<string name="section_lockscreen">Lockscreen</string>
|
||||
<string name="label_max_icons_per_row">Max icons per row</string>
|
||||
<string name="label_max_rows">Max rows</string>
|
||||
<string name="label_even_distribution">Even distribution</string>
|
||||
<string name="label_limit_screen_width">Limit to screen width</string>
|
||||
<string name="label_cutout_aware">Cutout aware</string>
|
||||
<string name="label_aod_keep_visible_during_call">Keep AOD visible during calls</string>
|
||||
<string name="label_aod_keep_visible_during_call_hint">Prevents SystemUI from suppressing AOD while an active call is in progress.</string>
|
||||
<string name="hidden_apps_dialog_title">Notification icon app blocks</string>
|
||||
<string name="hidden_apps_page_title">Hide notification icons</string>
|
||||
<string name="hidden_apps_dialog_subtitle">Pull down to refresh session apps. List contents are fixed until refresh.</string>
|
||||
<string name="hidden_apps_page_hint">Icons represent, in order:\nAOD, Lockscreen, Unlocked</string>
|
||||
<string name="hidden_apps_clear_session">Clear session list</string>
|
||||
<string name="hidden_apps_empty">No apps yet. Generate a notification first.</string>
|
||||
<string name="hidden_apps_close">Close</string>
|
||||
<string name="hidden_apps_exception_regex_input_hint">Regex</string>
|
||||
<plurals name="hidden_apps_package_with_exceptions">
|
||||
<item quantity="one">%1$s \u2022 %2$d exception</item>
|
||||
@@ -126,7 +108,6 @@
|
||||
<string name="hidden_apps_mode_unlock">Unlocked</string>
|
||||
<string name="hidden_apps_package_unknown">(unknown package)</string>
|
||||
<string name="status_chips_title">Status chips</string>
|
||||
<string name="status_chips_hint">Hide Samsung/SystemUI status chips (music, maps/navigation, call) in the top status area.</string>
|
||||
<string name="status_chips_hide_all_label">Hide other status chips (unlocked)</string>
|
||||
<string name="status_chips_hide_all_hint">Hides detected status chips that are not media, navigation or call. Privacy indicators are excluded.</string>
|
||||
<string name="status_chips_hide_media_unlocked_label">Hide media chip (unlocked)</string>
|
||||
@@ -142,9 +123,6 @@
|
||||
<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_alignment_title">Alignment</string>
|
||||
<string name="battery_bar_alignment_ltr">→</string>
|
||||
<string name="battery_bar_alignment_rtl">←</string>
|
||||
<string name="battery_bar_alignment_center">↔</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_curved_geometry_length">Follow screen edges</string>
|
||||
@@ -163,15 +141,12 @@
|
||||
<string name="battery_bar_thresholds_title">Threshold colours</string>
|
||||
<string name="battery_bar_thresholds_hint">Below a threshold, the first matching colour overrides the default.</string>
|
||||
<string name="battery_bar_add_threshold">Add threshold</string>
|
||||
<string name="battery_bar_colour_dialog_title">Set colour</string>
|
||||
<string name="battery_bar_colour_dialog_hint">Examples: #FA0, FA0, or #FA0 ; invRGB 0.5 *RGB</string>
|
||||
<string name="battery_bar_threshold_percent_title">Threshold percent</string>
|
||||
<string name="battery_bar_threshold_percent_hint">Applies when battery is at or below this percent.</string>
|
||||
<string name="battery_bar_threshold_change_percent">Change threshold %</string>
|
||||
<string name="battery_bar_threshold_label">Below %1$d%%</string>
|
||||
<string name="battery_bar_threshold_discharge_colour">Discharge colour</string>
|
||||
<string name="battery_bar_threshold_charge_colour">Charge colour</string>
|
||||
<string name="battery_bar_threshold_remove">Remove threshold</string>
|
||||
<string name="battery_bar_colour_auto">Auto</string>
|
||||
<string name="battery_bar_colour_same_as_discharge">Same as discharge</string>
|
||||
<string name="battery_bar_colour_same_as_default">Default</string>
|
||||
@@ -185,9 +160,7 @@
|
||||
<string name="layout_home_title">Layout</string>
|
||||
<string name="layout_title">Unlocked</string>
|
||||
<string name="layout_master_toggle_title">Master toggle</string>
|
||||
<string name="clock_enabled">Use custom clock</string>
|
||||
<string name="layout_enabled">Use custom layout</string>
|
||||
<string name="clock_position_title">Clock position</string>
|
||||
<string name="layout_clock_position_title">Clock</string>
|
||||
<string name="layout_carrier_position_title">Carrier</string>
|
||||
<string name="layout_chip_position_title">Status chip</string>
|
||||
@@ -234,7 +207,6 @@
|
||||
<string name="clock_vertical_offset_label">Vertical position</string>
|
||||
<string name="clock_middle_side_left">Left side</string>
|
||||
<string name="clock_middle_side_right">Right side</string>
|
||||
<string name="clock_custom_format_title">Custom format</string>
|
||||
<string name="clock_custom_format_statusbar_title">Statusbar clock</string>
|
||||
<string name="clock_custom_format_drawer_clock_title">Drawer clock</string>
|
||||
<string name="clock_custom_format_drawer_date_title">Drawer date</string>
|
||||
@@ -257,7 +229,6 @@
|
||||
<string name="clock_font_picker_hint">Search font family</string>
|
||||
<string name="clock_font_picker_copied">Copied: %1$s</string>
|
||||
<string name="clock_custom_format_help_link">Date/time pattern reference only: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html</string>
|
||||
<string name="clock_custom_format_invalid">Invalid pattern</string>
|
||||
<string name="label_battery_lockscreen_unplugged_percent">Unplugged battery % on lockscreen</string>
|
||||
<string name="label_battery_lockscreen_unplugged_percent_hint">Shows the plain battery percentage on the lockscreen when unplugged.</string>
|
||||
<string name="label_battery_aod_unplugged_percent">Unplugged battery % on AOD</string>
|
||||
|
||||
@@ -1,26 +1,4 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<style name="Theme.StatusBarTweak" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<item name="colorPrimary">@color/sbt_primary</item>
|
||||
<item name="colorPrimaryVariant">@color/sbt_primary_dark</item>
|
||||
<item name="colorOnPrimary">@color/sbt_on_primary</item>
|
||||
<item name="colorSecondary">@color/sbt_accent</item>
|
||||
<item name="colorSecondaryVariant">@color/sbt_accent_dark</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<item name="colorSurface">@color/sbt_surface</item>
|
||||
<item name="colorOnSurface">@color/sbt_on_surface</item>
|
||||
<item name="android:colorAccent">@color/sbt_accent</item>
|
||||
<item name="android:fontFamily">sans-serif</item>
|
||||
<item name="android:windowBackground">@drawable/sbt_window_background</item>
|
||||
<item name="android:navigationBarColor">@color/sbt_primary_dark</item>
|
||||
<item name="android:statusBarColor">@color/sbt_primary_dark</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="materialCardViewStyle">@style/Widget.StatusBarTweak.Card</item>
|
||||
<item name="materialButtonOutlinedStyle">@style/Widget.StatusBarTweak.OutlinedButton</item>
|
||||
<item name="materialAlertDialogTheme">@style/ThemeOverlay.StatusBarTweak.MaterialAlertDialog</item>
|
||||
<item name="sliderStyle">@style/Widget.StatusBarTweak.Slider</item>
|
||||
<item name="switchStyle">@style/Widget.StatusBarTweak.Switch</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.StatusBarTweak.NoActionBar" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/sbt_primary</item>
|
||||
<item name="colorPrimaryVariant">@color/sbt_primary_dark</item>
|
||||
|
||||
-3
@@ -125,9 +125,6 @@ public final class HarnessForegroundService extends Service {
|
||||
}
|
||||
|
||||
private void ensureChannel() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
NotificationManager nm = getSystemService(NotificationManager.class);
|
||||
if (nm == null) {
|
||||
return;
|
||||
|
||||
@@ -315,11 +315,7 @@ public final class MainActivity extends Activity {
|
||||
}
|
||||
Intent intent = new Intent(this, HarnessForegroundService.class);
|
||||
intent.setAction(action);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(intent);
|
||||
} else {
|
||||
startService(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopHarnessService() {
|
||||
@@ -337,9 +333,6 @@ public final class MainActivity extends Activity {
|
||||
}
|
||||
|
||||
private void ensureChannel(NotificationManager nm) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"StatusBarTweak harness",
|
||||
|
||||
@@ -444,19 +444,15 @@ public final class ScenarioActivity extends Activity {
|
||||
| WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
|
||||
controller.setSystemBarsAppearance(lightBars ? mask : 0, mask);
|
||||
}
|
||||
} else if (Build.VERSION.SDK_INT >= 23) {
|
||||
} else {
|
||||
int flags = getWindow().getDecorView().getSystemUiVisibility();
|
||||
if (lightBars) {
|
||||
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
} else {
|
||||
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
}
|
||||
getWindow().getDecorView().setSystemUiVisibility(flags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user