This may help others, I decided to use View.OnSystemUiVisibilityChangeListener here the snipet code
-------- View mDecorView = getWindow().getDecorView(); mDecorView.setOnSystemUiVisibilityChangeListener(mOnSystemUiVisibilityChangeListener); ------- hideSystemUI(); --------- private View.OnSystemUiVisibilityChangeListener mOnSystemUiVisibilityChangeListener = new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == View.VISIBLE) { mToolBar.startAnimation(mSlideDown); getSupportActionBar().show(); } else { getSupportActionBar().hide(); mToolBar.startAnimation(mSlideUp); } } };
Find a complete code example
source share