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.

Fullscreen setting: hides the status and navigation bars

CIS-C07288f3c69abf
diff --git a/app/src/main/java/com/rfsentinel/app/RFSentinelApp.kt b/app/src/main/java/com/rfsentinel/app/RFSentinelApp.kt
index d3562c8..d79d824 100644
--- a/app/src/main/java/com/rfsentinel/app/RFSentinelApp.kt
+++ b/app/src/main/java/com/rfsentinel/app/RFSentinelApp.kt
@@ -38,6 +38,21 @@ class RFSentinelApp : Application() {
if (a.requestedOrientation != wanted) a.requestedOrientation = wanted
}
+ /** Windows with the bars hidden by the setting. Only these get them back, so the map's own full screen is left alone. */
+ private val fullscreenWindows = java.util.Collections.newSetFromMap(java.util.WeakHashMap<android.app.Activity, Boolean>())
+
+ /** Settings > General > Fullscreen: no status or navigation bar; a swipe from the edge shows them for a moment. */
+ fun applyFullscreen(a: android.app.Activity) {
+ val bars = androidx.core.view.WindowCompat.getInsetsController(a.window, a.window.decorView)
+ val types = androidx.core.view.WindowInsetsCompat.Type.systemBars()
+ if (com.rfsentinel.app.util.Prefs.fullscreen(a)) {
+ bars.systemBarsBehavior = androidx.core.view.WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
+ bars.hide(types)
+ // Older Android versions bring the bars back after a dialog or the notification shade.
+ if (fullscreenWindows.add(a)) a.window.decorView.viewTreeObserver.addOnWindowFocusChangeListener { if (it) applyFullscreen(a) }
+ } else if (fullscreenWindows.remove(a)) bars.show(types)
+ }
+
override fun onCreate() {
super.onCreate()
com.rfsentinel.app.util.CrashLog.install(this)
@@ -49,7 +64,7 @@ class RFSentinelApp : Application() {
override fun onActivityStarted(a: android.app.Activity) { visibleActivities++ }
override fun onActivityStopped(a: android.app.Activity) { visibleActivities = (visibleActivities - 1).coerceAtLeast(0) }
override fun onActivityCreated(a: android.app.Activity, b: android.os.Bundle?) = applyOrientation(a)
- override fun onActivityResumed(a: android.app.Activity) = applyOrientation(a)
+ override fun onActivityResumed(a: android.app.Activity) { applyOrientation(a); applyFullscreen(a) }
override fun onActivityPaused(a: android.app.Activity) {}
override fun onActivitySaveInstanceState(a: android.app.Activity, b: android.os.Bundle) {}
override fun onActivityDestroyed(a: android.app.Activity) {}
diff --git a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
index bd56301..1b7f788 100644
--- a/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/settings/SettingsActivity.kt
@@ -694,6 +694,7 @@ class SettingsActivity : AppCompatActivity() {
"one (Android asks you once to allow RF Sentinel to install apps, then shows its own Update card). History and " +
"settings are kept, and scanning stops while it installs.\n\n" +
"Discreet mode: hides details on the lock screen and in notifications.\n\n" +
+ "Fullscreen: hides the status bar and Android's navigation bar for more room.\n\n" +
"Screen: \"On while charging\" suits a car or a desk; \"Normal\" turns off like other apps.\n\n" +
"Screen rotation: phones like the Pixel never auto-rotate upside down. \"Auto-rotate, upside down too\" turns " +
"the app whichever way the phone is held, upside down included (rotation lock still applies); \"Always upside down\" " +
@@ -1169,6 +1170,7 @@ class SettingsActivity : AppCompatActivity() {
info(binding.prereleaseSwitch, "Update checks also offer prerelease builds: test versions published on GitHub before " +
"a full release, with the newest features and more bugs. Off: only full releases are offered.")
info(binding.discreetSwitch, "Hides what was detected on the lock screen and in notifications.")
+ info(binding.fullscreenSwitch, "Hides the status bar and Android's navigation bar for more room. Swipe from the edge of the screen to see them for a moment.")
info(binding.screenLabel, "Always on: the screen never turns off while RF Sentinel is open.\n\nOn while charging: stays on in the car or on a desk (recommended).\n\nNormal: turns off like any other app.")
info(binding.rotationLabel, "Normal follows the phone's auto-rotate.\n\nAuto-rotate, upside down too: also turns upside down, which phones like the Pixel never do on their own.\n\nAlways upside down: the USB-C port at the top, for an antenna or adapter plugged in.")
info(binding.bannerLabel, "A picture across the header of the styled themes (a logo or artwork you own). Your custom themes have their own banner, set in the theme maker.")
@@ -2802,6 +2804,11 @@ class SettingsActivity : AppCompatActivity() {
binding.shortVoiceSwitch.isChecked = Prefs.shortVoice(this)
setupVoiceControls()
binding.discreetSwitch.isChecked = Prefs.discreetMode(this)
+ binding.fullscreenSwitch.isChecked = Prefs.fullscreen(this)
+ binding.fullscreenSwitch.setOnCheckedChangeListener { _, on ->
+ Prefs.setFullscreen(this, on)
+ (application as com.rfsentinel.app.RFSentinelApp).applyFullscreen(this) // right away
+ }
binding.rotationGroup.checkIndex(Prefs.rotation(this).ordinal)
binding.rotationGroup.setOnCheckedChangeListener { group, _ ->
Prefs.Rotation.entries.getOrNull(group.checkedIndex)?.let { Prefs.setRotation(this, it) }
diff --git a/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt b/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt
index 328b1fa..af7ab76 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/MapFragment.kt
@@ -937,7 +937,7 @@ class MapFragment : Fragment() {
act.supportActionBar?.let { if (on) it.hide() else it.show() }
val bars = androidx.core.view.WindowCompat.getInsetsController(act.window, b.root)
bars.systemBarsBehavior = androidx.core.view.WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
- if (on) bars.hide(WindowInsetsCompat.Type.systemBars()) else bars.show(WindowInsetsCompat.Type.systemBars())
+ if (on || Prefs.fullscreen(act)) bars.hide(WindowInsetsCompat.Type.systemBars()) else bars.show(WindowInsetsCompat.Type.systemBars())
b.mapFilterScroll.visibility = if (on) View.GONE else View.VISIBLE
b.controls.visibility = if (on || Navigator.active) View.GONE else View.VISIBLE
layoutBottomInset()
diff --git a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
index 7f08422..64ae074 100644
--- a/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
+++ b/app/src/main/java/com/rfsentinel/app/util/Prefs.kt
@@ -272,6 +272,9 @@ object Prefs {
?: if (bool(context, "upside_down", false)) Rotation.UPSIDE_DOWN else Rotation.NORMAL
fun setRotation(context: Context, value: Rotation) = sp(context).edit { putString("rotation_mode", value.name) }
+ fun fullscreen(context: Context): Boolean = bool(context, "fullscreen", false)
+ fun setFullscreen(context: Context, value: Boolean) = setBool(context, "fullscreen", value)
+
fun followerAlerts(context: Context): Boolean = bool(context, "follower_alerts", true)
fun setFollowerAlerts(context: Context, value: Boolean) = setBool(context, "follower_alerts", value)
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index e93bb47..515e8b4 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -40,6 +40,11 @@
android:id="@+id/discreetSwitch"
android:text="Discreet mode" />
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ style="@style/SettingsControl"
+ android:id="@+id/fullscreenSwitch"
+ android:text="Fullscreen" />
+
<TextView android:id="@+id/screenLabel" style="@style/SettingsLabel" android:text="Screen while the app is open" />
<RadioGroup