Detecting when system buttons are visible while using 'immersive mode'

Glitch picture Glitch · Nov 3, 2013 · Viewed 10.8k times · Source

I'm currently using immersive mode (API 19) for one of my Activities as follows:

getWindow().getDecorView()
            .setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                            | View.INVISIBLE);

This hides the system buttons and notification bar until the user swipes for them back. This works fine, however I wish to detect when the user makes the buttons visible again. I've tried a OnSystemUiVisibilityChangeListener but it does not trigger for this particular event.

Any ideas?

Answer

Douglas Drumond Kayama picture Douglas Drumond Kayama · Nov 3, 2013

From Android Developers video, when you're in immersive sticky mode, the app isn't notified.

Immersive sticky mode starts at 6:56 and around 7:25 Roman Nurik tells that the listener won't be triggered.

This is the video: http://youtu.be/cBi8fjv90E4?t=6m56s