This is a small library inspired by Telegram X status bar new alert written in Kotlin. It can show custom message with optional indeterminate progress in status bar area. Optional autohide feature can be tweaked with custom duration. When showing, status bar alert kindly hides status bar's icon with SYSTEM_UI_FLAG_LOW_PROFILE flag mode, if available from os.


Supported devices

This lib is supported by every device with a SDK level of at least 14 (Android 4+. On Android 4.x the alert will be drawn below the status).

Android X required for v1.1.0 and above, otherwise use old version v1.0.2.

Quick walkthrough


Step 1. Add the JitPack repository to your build file

gradle: add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		maven { url '' }

Add this line to your app's dependencies:

implementation 'com.fede987:status-bar-alert:1.2.0'

Quick Sample

Show a new status bar alert:

val statusBarAlertview: StatusBarAlertView = StatusBarAlert.Builder([email protected])
//update status bar alert view text at any time:
// show indeterminate progress:
// hide indeterminate progress:

Hide all status bar alerts for current activity with an optional "on hidden" callback:

StatusBarAlert.hide([email protected]) {
    // onHidden callback
    Toast.makeText([email protected], "Alert has been hidden.", Toast.LENGHT_SHORT).show()

// or just call:

StatusBarAlert.hide([email protected])