Skip to content

RF Sentinel (RFSentinel): free, open-source police detector app for Android. Spots police body cams, Flock ALPR cameras, AirTag trackers, Remote ID drones, smart glasses and fake cell towers from Bluetooth LE and WiFi. No root.

Setup: System default theme selected from the start

CIS-C0e5fc4a462281
diff --git a/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
index df370f3..bab28c0 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/SetupActivity.kt
@@ -113,8 +113,6 @@ class SetupActivity : AppCompatActivity() {
STEPS - 1 -> "Finish"
else -> "Next"
}
- // No theme is preselected: the user picks one before moving on.
- binding.nextButton.isEnabled = step != 1 || ThemeManager.isChosen(this)
binding.page.removeAllViews()
stopObservingPrefetch?.invoke(); stopObservingPrefetch = null
when (step) {
@@ -143,28 +141,24 @@ class SetupActivity : AppCompatActivity() {
}
private fun theme() {
- header("Pick a look", "Tap a theme to preview it right away. Pick one to continue.")
- val chosen = ThemeManager.isChosen(this)
+ header("Pick a look", "Tap a theme to preview it right away.")
val current = ThemeManager.current(this)
val custom = ThemeManager.custom(this)
ThemeManager.builtIn.forEach { t ->
val note = if (t == ThemeManager.AppTheme.MATERIAL_YOU && !ThemeManager.isDynamicColorAvailable)
" (this phone: standard Material 3 colours)" else ""
- card(t.title, t.description + note, selected = chosen && t == current) {
- val restyle = t != ThemeManager.current(this)
- if (restyle || !ThemeManager.isChosen(this)) {
+ card(t.title, t.description + note, selected = t == current) {
+ if (t != ThemeManager.current(this)) {
ThemeManager.set(this, t)
- if (restyle) {
- resumeStep = step
- resumeScroll = binding.pageScroll.scrollY
- recreate() // restyles this screen; the step is kept
- } else render()
+ resumeStep = step
+ resumeScroll = binding.pageScroll.scrollY
+ recreate() // restyles this screen; the step is kept
}
}
}
CustomThemes.all(this).forEach { c ->
- card(c.name, "Your own theme", selected = chosen && current == ThemeManager.AppTheme.CUSTOM && custom?.id == c.id) {
- if (!(ThemeManager.current(this) == ThemeManager.AppTheme.CUSTOM && ThemeManager.custom(this)?.id == c.id) || !ThemeManager.isChosen(this)) {
+ card(c.name, "Your own theme", selected = current == ThemeManager.AppTheme.CUSTOM && custom?.id == c.id) {
+ if (!(ThemeManager.current(this) == ThemeManager.AppTheme.CUSTOM && ThemeManager.custom(this)?.id == c.id)) {
ThemeManager.setCustom(this, c.id)
resumeStep = step
resumeScroll = binding.pageScroll.scrollY
diff --git a/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt b/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt
index 13622fa..6a4be35 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/ThemeManager.kt
@@ -110,10 +110,6 @@ object ThemeManager {
return if (c != null) c.title?.takeIf { it.isNotBlank() } else current(context).appTitle
}
- /** True once the user has picked a theme (the setup wizard requires one). */
- fun isChosen(context: Context): Boolean =
- context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).contains(KEY)
-
fun set(context: Context, theme: AppTheme) {
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit { putString(KEY, theme.name) }
applyNightMode(theme, custom(context))