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.

UX: permission settings prompt, watchlist search/export/undo, waterfall keeps zoom on rotate, Show all, match history search

CIS-C09f7965e0aad9
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6873129..3e54c68 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -87,7 +87,8 @@
<activity android:name=".ui.WifiAnalyzerActivity" android:exported="false" />
<activity android:name=".ui.AntennaCheckActivity" android:exported="false" />
<activity android:name=".ui.AircraftActivity" android:exported="false" />
- <activity android:name=".ui.WaterfallActivity" android:exported="false" />
+ <activity android:name=".ui.WaterfallActivity" android:exported="false"
+ android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" />
<activity
android:name=".ui.SetupActivity"
android:exported="false" />
diff --git a/app/src/main/java/com/rfsentinel/app/MainActivity.kt b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
index 9878ecc..e5e1334 100644
--- a/app/src/main/java/com/rfsentinel/app/MainActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/MainActivity.kt
@@ -81,9 +81,29 @@ class MainActivity : AppCompatActivity() {
startScanning()
} else {
binding.statusText.text = "Location and Bluetooth-scan permissions are required to scan"
+ // Denied for good: Android no longer shows its prompt, so Start alone would do nothing.
+ if (Permissions.missingRequired(this).any { !shouldShowRequestPermissionRationale(it) }) askForAppSettings()
}
}
+ /** The only way left to grant a refused permission: the app's page in Android's settings. */
+ private fun askForAppSettings() {
+ val what = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S)
+ "Location (precise) and Nearby devices" else "Location (precise)"
+ com.google.android.material.dialog.MaterialAlertDialogBuilder(this)
+ .setTitle("Permissions needed to scan")
+ .setMessage("RF Sentinel needs $what to scan, and Android won't ask again. " +
+ "Open the app's settings, then Permissions, and allow them.")
+ .setPositiveButton("Open app settings") { _, _ ->
+ runCatching {
+ startActivity(Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
+ android.net.Uri.fromParts("package", packageName, null)))
+ }
+ }
+ .setNegativeButton("Not now", null)
+ .show()
+ }
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Styled themes with a banner: the title bar sits over the banner's top, so the banner takes less room.
@@ -311,9 +331,9 @@ class MainActivity : AppCompatActivity() {
panes.apply()
// The "nothing heard" note sits over the list, or over the radar when there is no list.
val home = if (!panes.listShown && panes.radarShown) binding.radarPane else binding.listFrame
- if (binding.emptyText.parent !== home) {
- (binding.emptyText.parent as? android.view.ViewGroup)?.removeView(binding.emptyText)
- home.addView(binding.emptyText, android.widget.FrameLayout.LayoutParams(
+ if (binding.emptyState.parent !== home) {
+ (binding.emptyState.parent as? android.view.ViewGroup)?.removeView(binding.emptyState)
+ home.addView(binding.emptyState, android.widget.FrameLayout.LayoutParams(
android.widget.FrameLayout.LayoutParams.MATCH_PARENT, android.widget.FrameLayout.LayoutParams.WRAP_CONTENT,
android.view.Gravity.CENTER))
}
@@ -334,6 +354,9 @@ class MainActivity : AppCompatActivity() {
binding.filterChips.addView(chip)
if (f == filter) { chip.isChecked = true; scrollToChip(chip) }
}
+ binding.showAllButton.setOnClickListener {
+ filterChips[com.rfsentinel.app.ui.DeviceFilter.ALL]?.let { it.isChecked = true; scrollToChip(it) }
+ }
binding.filterChips.setOnCheckedStateChangeListener { _, ids ->
filter = filterChips.entries.firstOrNull { it.value.id == ids.firstOrNull() }?.key ?: return@setOnCheckedStateChangeListener
Prefs.setMapFilter(this, filter.name)
@@ -670,7 +693,10 @@ class MainActivity : AppCompatActivity() {
submitRows(airUrgent + radioLive + urgent + visible.map { toRow(it, now, threshold) } + airQuiet + radioOld + cells + quiet)
shownCells = cells.size + waze.size + radio.size + air.size
}
- binding.emptyText.visibility = if (visible.isEmpty() && (!panes.listShown || shownCells == 0)) View.VISIBLE else View.GONE
+ binding.emptyState.visibility = if (visible.isEmpty() && (!panes.listShown || shownCells == 0)) View.VISIBLE else View.GONE
+ // A filter that hides everything heard: one tap back to the full list.
+ binding.showAllButton.visibility =
+ if (filter != com.rfsentinel.app.ui.DeviceFilter.ALL && all.isNotEmpty()) View.VISIBLE else View.GONE
binding.emptyText.text = when {
all.isEmpty() && !ScanForegroundService.isRunning -> "Not scanning.\nTap Start scanning to begin."
all.isEmpty() -> "Listening... no devices heard yet."
diff --git a/app/src/main/java/com/rfsentinel/app/data/DetectionDao.kt b/app/src/main/java/com/rfsentinel/app/data/DetectionDao.kt
index a29a648..6037b5a 100644
--- a/app/src/main/java/com/rfsentinel/app/data/DetectionDao.kt
+++ b/app/src/main/java/com/rfsentinel/app/data/DetectionDao.kt
@@ -14,6 +14,19 @@ interface DetectionDao {
@Query("SELECT * FROM detections ORDER BY timestamp DESC LIMIT 1000")
fun recent(): Flow<List<DetectionEntity>>
+ /** Match history search: text in the address, label, maker, name or evidence; one category; since a time. */
+ @Query("""SELECT * FROM detections
+ WHERE timestamp >= :since AND (:category IS NULL OR category = :category)
+ AND (:query = '' OR mac LIKE :like ESCAPE '\' OR REPLACE(mac, ':', '') LIKE :likeHex ESCAPE '\'
+ OR label LIKE :like ESCAPE '\' OR vendor LIKE :like ESCAPE '\'
+ OR deviceName LIKE :like ESCAPE '\' OR evidence LIKE :like ESCAPE '\')
+ ORDER BY timestamp DESC LIMIT 1000""")
+ fun search(query: String, like: String, likeHex: String, category: String?, since: Long): Flow<List<DetectionEntity>>
+
+ /** The categories in the log, for the filter chips. */
+ @Query("SELECT DISTINCT category FROM detections")
+ suspend fun categories(): List<String>
+
@Query("SELECT * FROM detections WHERE mac = :mac ORDER BY timestamp DESC LIMIT 200")
suspend fun forMac(mac: String): List<DetectionEntity>
diff --git a/app/src/main/java/com/rfsentinel/app/ouilist/OuiListActivity.kt b/app/src/main/java/com/rfsentinel/app/ouilist/OuiListActivity.kt
index 2aa8c8b..52319fd 100644
--- a/app/src/main/java/com/rfsentinel/app/ouilist/OuiListActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ouilist/OuiListActivity.kt
@@ -7,6 +7,7 @@ import android.view.MenuItem
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.widget.doAfterTextChanged
import androidx.recyclerview.widget.LinearLayoutManager
import com.rfsentinel.app.databinding.ActivityOuiListBinding
import com.rfsentinel.app.oui.OuiEntry
@@ -59,6 +60,7 @@ class OuiListActivity : AppCompatActivity() {
}
binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.adapter = adapter
+ binding.searchInput.doAfterTextChanged { refresh() }
val types = RuleType.entries
binding.ruleType.setAdapter(android.widget.ArrayAdapter(this, android.R.layout.simple_list_item_1, types.map { it.label }))
@@ -77,10 +79,15 @@ class OuiListActivity : AppCompatActivity() {
} else if (label.isEmpty()) {
binding.labelInput.error = "Label required"
} else {
+ val before = OuiWatchlist.customEntry(key)
OuiWatchlist.addCustomEntry(this, OuiEntry(key, label, "user-added", "custom"))
binding.prefixInput.text?.clear()
binding.labelInput.text?.clear()
refresh()
+ com.rfsentinel.app.util.Undo.show(this, if (before != null) "Updated $label" else "Watching $label") {
+ if (before != null) OuiWatchlist.addCustomEntry(this, before) else OuiWatchlist.removeCustomEntry(this, key)
+ refresh()
+ }
}
}
@@ -109,7 +116,7 @@ class OuiListActivity : AppCompatActivity() {
}
override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) {
- 1 -> { Exporter.showExportMenu(this); true }
+ 1 -> { Exporter.showWatchlistExport(this); true }
2 -> { importLauncher.launch(arrayOf("application/json", "text/plain", "*/*")); true }
android.R.id.home -> { finish(); true }
else -> super.onOptionsItemSelected(item)
@@ -117,10 +124,19 @@ class OuiListActivity : AppCompatActivity() {
private fun refresh() {
OuiWatchlist.load(this)
+ val all = OuiWatchlist.allEntries()
+ // The search box: the rule, its label or where it came from (also an address typed without colons).
+ val q = binding.searchInput.text?.toString()?.trim().orEmpty()
+ val hex = q.replace(":", "").replace("-", "")
+ val shown = if (q.isEmpty()) all else all.filter { e ->
+ e.prefix.contains(q, true) || e.label.contains(q, true) || e.source.contains(q, true) ||
+ (hex.length >= 2 && e.prefix.replace(":", "").contains(hex, true))
+ }
// Your own entries first, then presets by confidence.
- adapter.update(OuiWatchlist.allEntries().sortedWith(
+ adapter.update(shown.sortedWith(
compareByDescending<OuiEntry> { it.isCustom }.thenByDescending { it.effectiveScore }
))
+ supportActionBar?.subtitle = if (q.isEmpty()) "${all.size} rules" else "${shown.size} of ${all.size} rules"
}
private companion object {
diff --git a/app/src/main/java/com/rfsentinel/app/ui/DetectionLogActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/DetectionLogActivity.kt
index 92ee541..d26d860 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/DetectionLogActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/DetectionLogActivity.kt
@@ -5,18 +5,34 @@ import android.view.Menu
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.widget.doAfterTextChanged
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
+import com.google.android.material.chip.Chip
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.rfsentinel.app.data.AppDatabase
+import com.rfsentinel.app.data.KnownDeviceDao
import com.rfsentinel.app.databinding.ActivityLogBinding
+import com.rfsentinel.app.detect.Category
import com.rfsentinel.app.util.Exporter
import com.rfsentinel.app.util.applySystemBarInsets
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
+import java.util.Calendar
-/** History of logged matches (the rows the exports contain). Tap one for device details. */
+/**
+ * History of logged matches (the rows the exports contain). Search by address, label, maker, name or
+ * evidence, and narrow to today or one kind of equipment. Tap one for device details.
+ */
class DetectionLogActivity : AppCompatActivity() {
private lateinit var binding: ActivityLogBinding
+ private lateinit var adapter: DetectionAdapter
+
+ /** The chip picked: everything, today, or one category (by name). */
+ private var today = false
+ private var category: String? = null
+ private var searchJob: Job? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -26,20 +42,56 @@ class DetectionLogActivity : AppCompatActivity() {
title = "Match history"
supportActionBar?.setDisplayHomeAsUpEnabled(true)
- val adapter = DetectionAdapter(onClick = { DeviceActions.openDetection(this, it) })
+ adapter = DetectionAdapter(onClick = { DeviceActions.openDetection(this, it) })
binding.recyclerView.layoutManager = LinearLayoutManager(this)
binding.recyclerView.adapter = adapter
+ binding.searchInput.doAfterTextChanged { search(now = false) }
+ buildChips()
+ search(now = true)
+ }
+
+ /** All, Today, then one chip per kind of equipment in the log. */
+ private fun buildChips() = lifecycleScope.launch {
+ val present = AppDatabase.getInstance(this@DetectionLogActivity).detectionDao().categories().toSet()
+ binding.filterChips.removeAllViews()
+ if (category != null && category !in present) category = null
+ fun add(label: String, checked: Boolean, pick: () -> Unit) {
+ binding.filterChips.addView(Chip(this@DetectionLogActivity, null, com.google.android.material.R.attr.chipStyle).apply {
+ id = View.generateViewId(); text = label; isCheckable = true; isCheckedIconVisible = false
+ ChipStyle.apply(this)
+ isChecked = checked
+ setOnClickListener { pick(); search(now = true) }
+ })
+ }
+ add("All", !today && category == null) { today = false; category = null }
+ add("Today", today) { today = true; category = null }
+ for (c in Category.entries) if (c.name in present) add(chipLabel(c), category == c.name) { today = false; category = c.name }
+ }
- lifecycleScope.launch {
- AppDatabase.getInstance(this@DetectionLogActivity).detectionDao().recent()
+ /** Collects the matches for the search box and chip, a moment after the last key so typing stays smooth. */
+ private fun search(now: Boolean) {
+ searchJob?.cancel()
+ searchJob = lifecycleScope.launch {
+ if (!now) delay(250)
+ val q = binding.searchInput.text?.toString()?.trim().orEmpty()
+ val since = if (today) startOfToday() else 0L
+ val filtered = q.isNotEmpty() || today || category != null
+ AppDatabase.getInstance(this@DetectionLogActivity).detectionDao()
+ .search(q, KnownDeviceDao.like(q), KnownDeviceDao.likeHex(q), category, since)
.collect { list ->
adapter.submitList(list)
binding.emptyText.visibility = if (list.isEmpty()) View.VISIBLE else View.GONE
- supportActionBar?.subtitle = "${list.size}${if (list.size >= 1000) "+" else ""} logged"
+ binding.emptyText.text = if (filtered) "Nothing matches." else "No watchlist matches logged yet."
+ val more = if (list.size >= 1000) "+" else ""
+ supportActionBar?.subtitle = "${list.size}$more ${if (filtered) "found" else "logged"}"
}
}
}
+ private fun startOfToday() = Calendar.getInstance().apply {
+ set(Calendar.HOUR_OF_DAY, 0); set(Calendar.MINUTE, 0); set(Calendar.SECOND, 0); set(Calendar.MILLISECOND, 0)
+ }.timeInMillis
+
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menu.add(0, 1, 0, "Export...")
menu.add(0, 2, 1, "Clear match history")
@@ -56,6 +108,7 @@ class DetectionLogActivity : AppCompatActivity() {
lifecycleScope.launch {
AppDatabase.getInstance(this@DetectionLogActivity).detectionDao().clearAll()
com.rfsentinel.app.data.AlertLog.clear(this@DetectionLogActivity)
+ buildChips()
}
}
.setNegativeButton("Cancel", null)
@@ -65,4 +118,29 @@ class DetectionLogActivity : AppCompatActivity() {
android.R.id.home -> { finish(); true }
else -> super.onOptionsItemSelected(item)
}
+
+ private companion object {
+ /** Short chip names for the categories. */
+ fun chipLabel(c: Category) = when (c) {
+ Category.BODY_CAM -> "Body cams"
+ Category.ALPR -> "Plate cameras"
+ Category.AUDIO_SENSOR -> "Audio sensors"
+ Category.PUBLIC_SAFETY -> "Public safety"
+ Category.DRONE -> "Drones"
+ Category.TRACKER -> "Trackers"
+ Category.GLASSES -> "Glasses"
+ Category.NETWORK_CAMERA -> "Cameras"
+ Category.CELL_ANOMALY -> "Cell towers"
+ Category.GNSS -> "GPS"
+ Category.RADIO -> "Radio"
+ Category.AIRCRAFT -> "Aircraft"
+ Category.POLICE_REPORT -> "Waze"
+ Category.OTHER_CAMERA -> "Hidden cameras"
+ Category.SKIMMER -> "Skimmers"
+ Category.HACKER -> "Hacking tools"
+ Category.V2X -> "V2X"
+ Category.CUSTOM -> "Watchlist"
+ else -> c.shortTag
+ }
+ }
}
diff --git a/app/src/main/java/com/rfsentinel/app/ui/WaterfallActivity.kt b/app/src/main/java/com/rfsentinel/app/ui/WaterfallActivity.kt
index b9cc445..36acdec 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/WaterfallActivity.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/WaterfallActivity.kt
@@ -71,8 +71,8 @@ class WaterfallActivity : AppCompatActivity() {
super.onStop()
SdrWaterfall.listener = null
queue.clear()
- // Radio detection never stays paused behind a closed screen.
- SdrRadio.tuneHz = null
+ // Radio detection never stays paused behind a closed screen (a redraw for a new theme comes straight back).
+ if (!isChangingConfigurations) SdrRadio.tuneHz = null
}
override fun onSupportNavigateUp(): Boolean { finish(); return true }
diff --git a/app/src/main/java/com/rfsentinel/app/ui/WaterfallView.kt b/app/src/main/java/com/rfsentinel/app/ui/WaterfallView.kt
index 49c2972..929c938 100644
--- a/app/src/main/java/com/rfsentinel/app/ui/WaterfallView.kt
+++ b/app/src/main/java/com/rfsentinel/app/ui/WaterfallView.kt
@@ -43,6 +43,7 @@ class WaterfallView @JvmOverloads constructor(context: Context, attrs: Attribute
// Where each pixel column comes from in the current rows' layout.
private var layoutKey = ""
+ private var layoutW = 0; private var layoutH = 0
private var colSeg = IntArray(0); private var colFrom = IntArray(0); private var colTo = IntArray(0)
private var colHz = LongArray(0)
/** Columns where one band stops and another starts (not side by side in frequency). */
@@ -73,8 +74,8 @@ class WaterfallView @JvmOverloads constructor(context: Context, attrs: Attribute
/** Adds the newest row; call on the main thread, then [invalidate]. */
fun add(row: SdrWaterfall.Row) {
val w = width; if (w <= 0 || height <= waterTop + 8 * density) return
- val key = row.tuned.toString() + w + row.segments.joinToString { "${it.startHz}-${it.endHz}" }
- if (key != layoutKey) relayout(row, w, key)
+ val key = row.tuned.toString() + row.segments.joinToString { "${it.startHz}-${it.endHz}" }
+ if (key != layoutKey || w != layoutW || height != layoutH) relayout(row, w, key)
// One value per column: the strongest bin under it, so a narrow signal never falls between pixels.
val values = FloatArray(w) { x ->
val d = row.segments[colSeg[x]].db
@@ -94,7 +95,10 @@ class WaterfallView @JvmOverloads constructor(context: Context, attrs: Attribute
}
private fun relayout(row: SdrWaterfall.Row, w: Int, key: String) {
- layoutKey = key; tuned = row.tuned
+ // Only the size changed (the phone turned): the rows so far are kept, stretched to the new width.
+ val old = bitmap?.takeIf { key == layoutKey && rows > 0 && !it.isRecycled }
+ val oldRows = rows; val oldNewest = newest
+ layoutKey = key; layoutW = w; layoutH = height; tuned = row.tuned
val segs = row.segments
val total = segs.sumOf { it.endHz - it.startHz }.coerceAtLeast(1)
colSeg = IntArray(w); colFrom = IntArray(w); colTo = IntArray(w); colHz = LongArray(w)
@@ -118,13 +122,24 @@ class WaterfallView @JvmOverloads constructor(context: Context, attrs: Attribute
// The sweep gives a row every second or two: taller rows, so the history isn't a thin strip.
val rowPx = if (row.tuned) 1f else 4 * density
val h = ((height - waterTop) / rowPx).toInt().coerceAtLeast(1)
+ val fresh = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888).apply { eraseColor(Color.BLACK) }
+ pixels = IntArray(w); newest = 0; rows = 0; spectrum = null; peak = null
+ if (old != null) {
+ // Newest first from row 0, as the screen shows them; the next row goes in above (ring buffer).
+ val c = Canvas(fresh)
+ val keep = minOf(oldRows, h)
+ val first = minOf(keep, old.height - oldNewest)
+ c.drawBitmap(old, Rect(0, oldNewest, old.width, oldNewest + first), Rect(0, 0, w, first), bitmapPaint)
+ if (keep > first) c.drawBitmap(old, Rect(0, 0, old.width, keep - first), Rect(0, first, w, keep), bitmapPaint)
+ rows = keep
+ } else floor = Float.NaN
bitmap?.recycle()
- bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888).apply { eraseColor(Color.BLACK) }
- pixels = IntArray(w); newest = 0; rows = 0; spectrum = null; peak = null; floor = Float.NaN
+ bitmap = fresh
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
- if (w != oldw || h != oldh) { layoutKey = ""; bitmap?.recycle(); bitmap = null }
+ // The next row lays it out again at the new size, keeping the rows so far.
+ if (w != oldw || h != oldh) invalidate()
}
override fun onDetachedFromWindow() {
diff --git a/app/src/main/java/com/rfsentinel/app/util/Exporter.kt b/app/src/main/java/com/rfsentinel/app/util/Exporter.kt
index 71e2ace..caff568 100644
--- a/app/src/main/java/com/rfsentinel/app/util/Exporter.kt
+++ b/app/src/main/java/com/rfsentinel/app/util/Exporter.kt
@@ -56,6 +56,9 @@ object Exporter {
/** Shortcut straight to the device history's formats (CSV / JSON): what Import history reads back. */
fun showHistoryExport(activity: AppCompatActivity) = chooseFormat(activity, Scope.HISTORY)
+ /** Shortcut straight to the watchlist file (it has one format). */
+ fun showWatchlistExport(activity: AppCompatActivity) = exportWatchlist(activity)
+
/** Shortcut straight to the "all nearby devices" formats. */
fun showExportAll(activity: AppCompatActivity) = chooseFormat(activity, Scope.SESSION)
diff --git a/app/src/main/res/layout/activity_log.xml b/app/src/main/res/layout/activity_log.xml
index ea59d74..1085e4c 100644
--- a/app/src/main/res/layout/activity_log.xml
+++ b/app/src/main/res/layout/activity_log.xml
@@ -1,8 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:padding="16dp">
+ android:orientation="vertical"
+ android:paddingStart="16dp"
+ android:paddingTop="8dp"
+ android:paddingEnd="16dp">
+
+ <!-- Address, label, maker, name or evidence. -->
+ <com.google.android.material.textfield.TextInputLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="Search MAC, label, maker, name"
+ app:endIconMode="clear_text"
+ app:startIconDrawable="@drawable/ic_search">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/searchInput"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:imeOptions="actionSearch"
+ android:importantForAutofill="no"
+ android:inputType="text"
+ android:maxLines="1" />
+ </com.google.android.material.textfield.TextInputLayout>
+
+ <HorizontalScrollView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:scrollbars="none">
+
+ <com.google.android.material.chip.ChipGroup
+ android:id="@+id/filterChips"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:selectionRequired="true"
+ app:singleLine="true"
+ app:singleSelection="true" />
+ </HorizontalScrollView>
+
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
@@ -18,4 +59,5 @@
android:padding="24dp"
android:textColor="?android:attr/textColorSecondary"
android:text="No watchlist matches logged yet." />
-</FrameLayout>
+ </FrameLayout>
+</LinearLayout>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 95b2d0e..4dd78cf 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -255,15 +255,32 @@
android:paddingBottom="8dp" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
- <TextView
- android:id="@+id/emptyText"
+ <LinearLayout
+ android:id="@+id/emptyState"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:gravity="center"
- android:padding="24dp"
- android:text="No devices heard yet.\nTap a device for full details.\nLong-press for quick actions (watchlist, whitelist, favorite)."
- android:textColor="?android:attr/textColorSecondary" />
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/emptyText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:padding="24dp"
+ android:text="No devices heard yet.\nTap a device for full details.\nLong-press for quick actions (watchlist, whitelist, favorite)."
+ android:textColor="?android:attr/textColorSecondary" />
+
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/showAllButton"
+ style="?attr/materialButtonOutlinedStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dp"
+ android:text="Show all"
+ android:visibility="gone" />
+ </LinearLayout>
<!-- Scrolled down when a new alert arrives above: tap to go up to it. -->
<TextView
diff --git a/app/src/main/res/layout/activity_oui_list.xml b/app/src/main/res/layout/activity_oui_list.xml
index 95795f7..ab20de3 100644
--- a/app/src/main/res/layout/activity_oui_list.xml
+++ b/app/src/main/res/layout/activity_oui_list.xml
@@ -53,6 +53,25 @@
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_caption" />
+ <!-- Filters the list below: rule, label or source. -->
+ <com.google.android.material.textfield.TextInputLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:hint="Search rules"
+ app:endIconMode="clear_text"
+ app:startIconDrawable="@drawable/ic_search">
+
+ <com.google.android.material.textfield.TextInputEditText
+ android:id="@+id/searchInput"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:imeOptions="actionSearch"
+ android:importantForAutofill="no"
+ android:inputType="text"
+ android:maxLines="1" />
+ </com.google.android.material.textfield.TextInputLayout>
+
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"