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.

Start button: fall back to the icon alone instead of a cut-off word

CIS-C0dca1de48a883
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
index d09014a..6a61845 100644
--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
@@ -593,9 +593,8 @@ class MainActivity : AppCompatActivity() {
}
/**
- * "Start" / "Stop" with its icon when both fit; with less room the icon goes and the word stays. When
- * even the word would be cut off (large text, a narrow window, the view buttons beside it) the word goes
- * and the icon stays on its own: a play triangle to start, a stop square to stop (the colour and the
+ * "Start" / "Stop" with its icon when both fit. Otherwise (large text, a narrow window, the view buttons
+ * beside it) the word goes, never cut off, and the icon stays on its own: a play triangle to start, a stop square to stop (the colour and the
* description say the same), centred in the button with no side padding so the icon is never clipped.
*/
private var startIconPadding = -1
@@ -626,7 +625,6 @@ class MainActivity : AppCompatActivity() {
val textW = b.paint.measureText(drawn) * 1.1f + 6 * d
val iconW = (b.iconSize.takeIf { it > 0 } ?: (24 * d).toInt()) + startIconPadding
if (textW + iconW <= room) withWord()
- else if (textW <= room) { withWord(); b.icon = null }
else {
// The icon alone, in the middle of the button: "text start" gravity centres the icon with its text, here an
// invisible zero-width one (with no text at all the button keeps the icon at its start).