OverlayChip

Manages system overlay chips that appear on top of other apps.

This object provides a full-screen overlay that can display:

  • Warning messages
  • Lock notifications
  • Break reminders
  • Action buttons (Take break, Keep scrolling, etc.)

Features:

  • Requires SYSTEM_ALERT_WINDOW permission
  • Automatically removes existing overlay before showing new one
  • Handles click callbacks for primary and secondary actions

See also

AppScrollDetector

Functions

Link copied to clipboard
fun hide(context: Context)

Hides the currently displayed overlay chip.

Link copied to clipboard
fun show(context: Context, title: String, message: String, primary: String, secondary: String? = null, onPrimary: () -> Unit? = null, onSecondary: () -> Unit? = null)

Shows an overlay chip with title, message, and action buttons.