From d1160a2d2dd593900737c3af26c1814c60922a1d Mon Sep 17 00:00:00 2001 From: ajp_anton Date: Tue, 23 Jun 2026 12:37:59 +0000 Subject: [PATCH] Avoid stock statusbar flash when enabling layout --- .../features/clock/StockClockController.java | 23 +++++++++---------- ...ckUnlockedNotificationIconsController.java | 3 +++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/clock/StockClockController.java b/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/clock/StockClockController.java index 95ad12f..a3e7ea9 100644 --- a/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/clock/StockClockController.java +++ b/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/clock/StockClockController.java @@ -153,7 +153,7 @@ final class StockClockController { } runtimeContext.getModeStateRepository().addLayoutEnabledListener(enabled -> { if (enabled) { - restoreAllOwnedClocks(); + suspendOwnedClockTickers(); } else { refreshAllClocks(); } @@ -212,23 +212,22 @@ final class StockClockController { } } - private void removeAllRowOverlays() { - for (TextView clockView : new ArrayList<>(trackedClocks)) { - removeRowOverlay(clockView); + private void suspendOwnedClockTickers() { + for (TextView clockView : new ArrayList<>(ownedClocks)) { + stopTicker(clockView); } } - private void restoreAllOwnedClocks() { - for (TextView clockView : new ArrayList<>(trackedClocks)) { - restoreOwnedClock(clockView); - } - removeAllRowOverlays(); - } - private void applyClockText(TextView clockView) { SbtSettings settings = RuntimeSettingsCache.get(clockView.getContext()); boolean layoutEnabled = settings.clockEnabled; - if (layoutEnabled || !hasCustomClockTextEnabled(settings)) { + if (layoutEnabled) { + if (ownedClocks.contains(clockView)) { + stopTicker(clockView); + } + return; + } + if (!hasCustomClockTextEnabled(settings)) { restoreOwnedClock(clockView); return; } diff --git a/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/notifications/StockUnlockedNotificationIconsController.java b/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/notifications/StockUnlockedNotificationIconsController.java index 0859fe6..2f994e9 100644 --- a/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/notifications/StockUnlockedNotificationIconsController.java +++ b/app/src/main/java/se/ajpanton/statusbartweak/runtime/features/notifications/StockUnlockedNotificationIconsController.java @@ -237,6 +237,9 @@ final class StockUnlockedNotificationIconsController { } private boolean shouldManageContainer(View view) { + if (!isFeatureEnabled(view.getContext())) { + return false; + } if (!isUnlockedScene()) { return false; }