Building StareBrain, Part 19: Voice Input While Another App Is in the Foreground
Parts 16β18 covered the overlay UI: how it appears, how users reposition it, and how it collapses when they're actively using another app. Today we add voice input.
The core constraint: StareBrain should accept a spoken instruction while the user is in a completely different app β without requiring them to switch back to StareBrain first.
The Trigger: Floating Mic Button
The overlay already floats above every app. We add a small mic button to its collapsed state. Tapping it starts a voice session without leaving whatever app the user is in.
class OverlayView ( context : Context ) : FrameLayout ( context ) {
var onMicTapped : (() -> Unit )? = null
private val micButton : ImageButton = ImageButton ( context ). apply { setImageResource ( R . drawable . ic_mic ) setOnClickListener { onMicTapped ?.β¦