Menu

Building StareBrain, Part 16: The Overlay UI That Stays Out of the Way
πŸ“°

Building StareBrain, Part 16: The Overlay UI That Stays Out of the Way

DEV Community: androidΒ·StareBrainΒ·10 days ago
#B7LOvB2I
#devtoandroid#devto#dev#windowmanager#task
Reading 0:00
15s threshold

Building StareBrain, Part 16: The Overlay UI That Stays Out of the Way

Every part of this series so far has been invisible to the user β€” task execution, obstruction detection, replanning, context building. Today we surface it.

StareBrain runs as an overlay: a persistent UI layer that floats above whatever app the user is in. It has to show task progress without blocking the screen, surface confirmation prompts without breaking flow, and collapse to almost nothing when it's not needed.

Here's how we built it.

The Window

Android overlays use TYPE_APPLICATION_OVERLAY (requires SYSTEM_ALERT_WINDOW permission). The window is added via WindowManager , not an Activity β€” it lives outside the normal view hierarchy.

class OverlayManager ( private val context : Context ) {

private val windowManager = context . getSystemService ( WindowManager :: class . java ) private var overlayView : OverlayView ? = null

fun show () { if ( overlayView != null ) return val params = WindowManager .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.