Skip to content

Instantly share code, notes, and snippets.

@auyanik
Created January 27, 2021 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auyanik/6ace686ba644a9b7ec1ab5fa241a759a to your computer and use it in GitHub Desktop.
Save auyanik/6ace686ba644a9b7ec1ab5fa241a759a to your computer and use it in GitHub Desktop.
DeviceDecorViewListener
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