diff --git a/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedIconSnapshotRenderController.java b/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedIconSnapshotRenderController.java
index 66a31b2..0ec09d1 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedIconSnapshotRenderController.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedIconSnapshotRenderController.java
@@ -325,7 +325,6 @@ public final class UnlockedIconSnapshotRenderController {
}
if (scene.isLockscreen()) {
return settings.layoutNotifEnabledLockscreen
- && !"none".equals(settings.lockedNotificationMode)
&& scene.notificationDisplayStyle() != se.ajpanton.statusbartweak.runtime.mode.NotificationDisplayStyle.NONE
&& scene.notificationDisplayStyle() != se.ajpanton.statusbartweak.runtime.mode.NotificationDisplayStyle.CARDS;
}
diff --git a/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedLayoutPlanner.java b/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedLayoutPlanner.java
index 986e2e4..df62cb6 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedLayoutPlanner.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/runtime/render/UnlockedLayoutPlanner.java
@@ -550,9 +550,6 @@ final class UnlockedLayoutPlanner {
private int notificationCountForScene(SbtSettings settings, SceneKey scene) {
if (scene != null && scene.isLockscreen()) {
- if ("none".equals(settings.lockedNotificationMode)) {
- return 0;
- }
NotificationDisplayStyle style = scene.notificationDisplayStyle();
if (style == NotificationDisplayStyle.NONE || style == NotificationDisplayStyle.CARDS) {
return 0;
diff --git a/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/SbtSettings.java b/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/SbtSettings.java
index 6a7878e..218182b 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/SbtSettings.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/SbtSettings.java
@@ -688,7 +688,7 @@ public final class SbtSettings {
} else {
this.appIconExceptionRules = Collections.emptyMap();
}
- this.lockedNotificationMode = lockedNotificationMode != null ? lockedNotificationMode : "dot";
+ this.lockedNotificationMode = sanitizeLockedNotificationMode(lockedNotificationMode);
this.debugVisualizeNotificationContainer = debugVisualizeNotificationContainer;
this.debugVisualizeStatusContainer = debugVisualizeStatusContainer;
this.debugVisualizeClockContainer = debugVisualizeClockContainer;
@@ -815,6 +815,13 @@ public final class SbtSettings {
);
}
+ private static String sanitizeLockedNotificationMode(String mode) {
+ if ("cards".equals(mode) || "icons".equals(mode) || "dot".equals(mode)) {
+ return mode;
+ }
+ return "dot";
+ }
+
public static SbtSettings from(Context context) {
if (context == null) {
return defaults();
diff --git a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/IconsDebugFragment.java b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/IconsDebugFragment.java
index 0e64c82..ba97d0e 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/IconsDebugFragment.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/IconsDebugFragment.java
@@ -26,7 +26,6 @@ import java.util.Map;
import se.ajpanton.statusbartweak.R;
import se.ajpanton.statusbartweak.shell.debug.DebugNotifications;
-import se.ajpanton.statusbartweak.shell.debug.NotificationDisplayStyleSettings;
import se.ajpanton.statusbartweak.shell.settings.ClockCameraTypeSupport;
import se.ajpanton.statusbartweak.shell.settings.SbtDefaults;
import se.ajpanton.statusbartweak.shell.settings.SbtSettings;
@@ -62,10 +61,6 @@ public class IconsDebugFragment extends Fragment {
root.findViewById(R.id.debug_visualize_camera_cutout_switch);
MaterialButton restartSystemUiButton = root.findViewById(R.id.debug_restart_systemui_button);
SwitchMaterial cycleIconsSwitch = root.findViewById(R.id.debug_cycle_icons_switch);
- TextView notificationStyleCurrent = root.findViewById(R.id.debug_notification_style_current);
- MaterialButton notificationStyleCards = root.findViewById(R.id.debug_notification_style_cards);
- MaterialButton notificationStyleIcons = root.findViewById(R.id.debug_notification_style_icons);
- MaterialButton notificationStyleDot = root.findViewById(R.id.debug_notification_style_dot);
TextView currentCameraIdentified = root.findViewById(R.id.debug_camera_current_identified);
LinearLayout currentCameraOverrideRow = root.findViewById(R.id.debug_camera_current_override_row);
TextView currentCameraOverride = root.findViewById(R.id.debug_camera_current_override);
@@ -112,11 +107,6 @@ public class IconsDebugFragment extends Fragment {
SbtSettings.KEY_DEBUG_VISUALIZE_CAMERA_CUTOUT,
SbtDefaults.DEBUG_VISUALIZE_CAMERA_CUTOUT_DEFAULT);
bindRestartSystemUiButton(restartSystemUiButton);
- bindNotificationStyleControls(
- notificationStyleCurrent,
- notificationStyleCards,
- notificationStyleIcons,
- notificationStyleDot);
updateVisualizerSwitchAvailability(
prefs,
visualizeNotificationContainerSwitch,
@@ -198,76 +188,6 @@ public class IconsDebugFragment extends Fragment {
restartButton.setOnClickListener(v -> restartSystemUi());
}
- private void bindNotificationStyleControls(
- TextView currentView,
- MaterialButton cardsButton,
- MaterialButton iconsButton,
- MaterialButton dotButton
- ) {
- updateNotificationStyleUi(currentView);
- if (cardsButton != null) {
- cardsButton.setOnClickListener(v -> writeNotificationStyle(
- NotificationDisplayStyleSettings.Style.CARDS,
- currentView));
- }
- if (iconsButton != null) {
- iconsButton.setOnClickListener(v -> writeNotificationStyle(
- NotificationDisplayStyleSettings.Style.ICONS,
- currentView));
- }
- if (dotButton != null) {
- dotButton.setOnClickListener(v -> writeNotificationStyle(
- NotificationDisplayStyleSettings.Style.DOT,
- currentView));
- }
- }
-
- private void updateNotificationStyleUi(TextView currentView) {
- Context context = requireContext();
- NotificationDisplayStyleSettings.State state =
- NotificationDisplayStyleSettings.read(context);
- if (currentView != null) {
- currentView.setText(getString(
- R.string.debug_notification_style_current,
- readableNotificationStyle(state.style())));
- }
- }
-
- private void writeNotificationStyle(
- NotificationDisplayStyleSettings.Style style,
- TextView currentView
- ) {
- Context appContext = requireContext().getApplicationContext();
- new Thread(() -> {
- boolean success = NotificationDisplayStyleSettings.write(appContext, style);
- if (!isAdded()) {
- return;
- }
- requireActivity().runOnUiThread(() -> {
- updateNotificationStyleUi(currentView);
- Toast.makeText(
- requireContext(),
- success
- ? R.string.debug_notification_style_write_done
- : R.string.debug_notification_style_write_failed,
- success ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG).show();
- });
- }, "StatusBarTweak:NotificationStyleWrite").start();
- }
-
- private String readableNotificationStyle(NotificationDisplayStyleSettings.Style style) {
- if (style == NotificationDisplayStyleSettings.Style.CARDS) {
- return getString(R.string.debug_notification_style_cards);
- }
- if (style == NotificationDisplayStyleSettings.Style.ICONS) {
- return getString(R.string.debug_notification_style_icons);
- }
- if (style == NotificationDisplayStyleSettings.Style.DOT) {
- return getString(R.string.debug_notification_style_dot);
- }
- return getString(R.string.debug_notification_style_unknown);
- }
-
private void updateVisualizerSwitchAvailability(SharedPreferences prefs,
SwitchMaterial notificationSwitch,
SwitchMaterial statusSwitch,
diff --git a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LayoutHomeFragment.java b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LayoutHomeFragment.java
index c0bb1ad..352b7a5 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LayoutHomeFragment.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LayoutHomeFragment.java
@@ -90,8 +90,7 @@ public final class LayoutHomeFragment extends Fragment {
requireContext(),
prefs,
lockedModeGroup,
- lockedModeHint,
- layoutEnabled);
+ lockedModeHint);
}
private View paddingCard(Context context, SharedPreferences prefs) {
diff --git a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedNotificationModeUi.java b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedNotificationModeUi.java
index ed334c7..c57201a 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedNotificationModeUi.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedNotificationModeUi.java
@@ -16,7 +16,6 @@ final class LockedNotificationModeUi {
static final String MODE_CARDS = "cards";
static final String MODE_ICONS = "icons";
static final String MODE_DOT = "dot";
- static final String MODE_NONE = "none";
private LockedNotificationModeUi() {
}
@@ -25,10 +24,9 @@ final class LockedNotificationModeUi {
Context context,
SharedPreferences prefs,
RadioGroup group,
- TextView hint,
- boolean layoutEnabled
+ TextView hint
) {
- bind(context, prefs, group, hint, layoutEnabled, null);
+ bind(context, prefs, group, hint, null);
}
static void bind(
@@ -36,7 +34,6 @@ final class LockedNotificationModeUi {
SharedPreferences prefs,
RadioGroup group,
TextView hint,
- boolean layoutEnabled,
Runnable onChanged
) {
if (context == null || prefs == null || group == null) {
@@ -46,45 +43,29 @@ final class LockedNotificationModeUi {
RadioButton cards = button(context, R.string.debug_notification_style_cards, MODE_CARDS);
RadioButton icons = button(context, R.string.debug_notification_style_icons, MODE_ICONS);
RadioButton dot = button(context, R.string.debug_notification_style_dot, MODE_DOT);
- RadioButton none = button(context, R.string.layout_locked_notifications_none, MODE_NONE);
group.removeAllViews();
group.addView(cards);
group.addView(icons);
group.addView(dot);
- group.addView(none);
- String stored = prefs.getString(SbtSettings.KEY_LOCKED_NOTIFICATION_MODE, MODE_DOT);
NotificationDisplayStyleSettings.Style androidStyle =
NotificationDisplayStyleSettings.read(context).style();
- String current = currentMode(androidStyle, stored, layoutEnabled);
- if (layoutEnabled && MODE_NONE.equals(stored)
- && androidStyle != NotificationDisplayStyleSettings.Style.DOT) {
- writeMode(context, MODE_NONE);
- }
+ String current = currentMode(androidStyle);
group.check(idForMode(group, current));
- none.setEnabled(layoutEnabled);
- none.setAlpha(layoutEnabled ? 1f : 0.45f);
if (hint != null) {
- boolean rememberedNone = MODE_NONE.equals(stored) && !layoutEnabled;
- hint.setText(rememberedNone
- ? R.string.layout_locked_notifications_none_disabled
- : R.string.layout_locked_notifications_hint);
+ hint.setText(R.string.layout_locked_notifications_hint);
}
group.setOnCheckedChangeListener((radioGroup, checkedId) -> {
String mode = modeForId(radioGroup, checkedId);
- if (MODE_NONE.equals(mode) && !layoutEnabled) {
- radioGroup.check(idForMode(radioGroup, MODE_DOT));
- return;
- }
boolean ok = writeMode(context, mode);
if (!ok) {
Toast.makeText(
context,
R.string.debug_notification_style_write_failed,
Toast.LENGTH_SHORT).show();
- bind(context, prefs, group, hint, layoutEnabled);
+ bind(context, prefs, group, hint);
return;
}
prefs.edit().putString(SbtSettings.KEY_LOCKED_NOTIFICATION_MODE, mode).apply();
@@ -95,21 +76,13 @@ final class LockedNotificationModeUi {
});
}
- static String currentMode(Context context, SharedPreferences prefs, boolean layoutEnabled) {
- String stored = prefs.getString(SbtSettings.KEY_LOCKED_NOTIFICATION_MODE, MODE_DOT);
+ static String currentMode(Context context) {
NotificationDisplayStyleSettings.Style style =
NotificationDisplayStyleSettings.read(context).style();
- return currentMode(style, stored, layoutEnabled);
+ return currentMode(style);
}
- private static String currentMode(
- NotificationDisplayStyleSettings.Style androidStyle,
- String stored,
- boolean layoutEnabled
- ) {
- if (MODE_NONE.equals(stored) && layoutEnabled) {
- return MODE_NONE;
- }
+ private static String currentMode(NotificationDisplayStyleSettings.Style androidStyle) {
if (androidStyle == NotificationDisplayStyleSettings.Style.CARDS) {
return MODE_CARDS;
}
diff --git a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedSceneLayoutFragment.java b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedSceneLayoutFragment.java
index 6ba4f79..71a9a7b 100644
--- a/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedSceneLayoutFragment.java
+++ b/app/src/main/java/se/ajpanton/statusbartweak/shell/ui/LockedSceneLayoutFragment.java
@@ -66,18 +66,16 @@ abstract class LockedSceneLayoutFragment extends Fragment {
}
private void bindMode(Context context, SharedPreferences prefs) {
- boolean layoutEnabled = prefs.getBoolean(SbtSettings.KEY_CLOCK_ENABLED, SbtDefaults.CLOCK_ENABLED_DEFAULT);
LockedNotificationModeUi.bind(
context,
prefs,
modeGroup,
modeHint,
- layoutEnabled,
() -> rebuildDynamic(
context,
prefs,
- LockedNotificationModeUi.currentMode(context, prefs, layoutEnabled)));
- rebuildDynamic(context, prefs, LockedNotificationModeUi.currentMode(context, prefs, layoutEnabled));
+ LockedNotificationModeUi.currentMode(context)));
+ rebuildDynamic(context, prefs, LockedNotificationModeUi.currentMode(context));
}
private void rebuildDynamic(Context context, SharedPreferences prefs, String mode) {
@@ -168,7 +166,7 @@ abstract class LockedSceneLayoutFragment extends Fragment {
SbtDefaults.LAYOUT_STATUS_VERTICAL_OFFSET_PX_DEFAULT));
if (LockedNotificationModeUi.MODE_CARDS.equals(mode)) {
cardsByOrderKey.put("notifications", cardsNotificationCard(context, prefs));
- } else if (!LockedNotificationModeUi.MODE_NONE.equals(mode)) {
+ } else {
cardsByOrderKey.put("notifications", configuredIconContainersCardFromLayout(
context,
prefs,
diff --git a/app/src/main/res/layout/fragment_icons_debug.xml b/app/src/main/res/layout/fragment_icons_debug.xml
index 865f1c3..de05698 100644
--- a/app/src/main/res/layout/fragment_icons_debug.xml
+++ b/app/src/main/res/layout/fragment_icons_debug.xml
@@ -73,81 +73,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Restart SystemUI
SystemUI restart requested.
Could not restart SystemUI. Root shell failed.
- Android notification style
- Current: %1$s
- Temporary control for Samsung lockscreen/AOD notification style. Writes use root shell.
Cards
Icons
Dot
- unknown
Could not write notification style. Root shell failed.
- Notification style changed.
Notification icons
Cycle debug icons
Cycles visible debug icons between 0 and the configured count every 2 seconds.
@@ -177,8 +172,6 @@
Number of containers
Locked notifications mode
Mirrors the Samsung notification display style for AOD and lockscreen.
- None
- None is remembered, but Layout OFF uses Dot.
Misc
Max unlocked icons per row
Padding