Created
January 27, 2021 10:39
-
-
Save auyanik/6ace686ba644a9b7ec1ab5fa241a759a to your computer and use it in GitHub Desktop.
DeviceDecorViewListener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requireActivity().window.decorView.setOnSystemUiVisibilityChangeListener { visibility -> | |
// Note that system bars will only be "visible" if none of the | |
// LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set. | |
if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) { | |
// TODO: The system bars are visible. Make any desired | |
// adjustments to your UI, such as showing the action bar or | |
// other navigational controls. | |
Handler(Looper.getMainLooper()).postDelayed({ | |
hideSystemUi() | |
}, 2000) | |
} else { | |
// TODO: The system bars are NOT visible. Make any desired | |
// adjustments to your UI, such as hiding the action bar or | |
// other navigational controls. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment