Created
January 22, 2019 02:55
-
-
Save Bradleycorn/20ae379495ac9228cfc45f7fc2a4bf11 to your computer and use it in GitHub Desktop.
This file contains 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
override fun onConfigurationChanged(newConfig: Configuration) { | |
super.onConfigurationChanged(newConfig) | |
val isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE | |
if (isLandscape) { | |
supportActionBar?.hide() | |
supportActionBar?.setDisplayShowTitleEnabled(false) | |
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) | |
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) | |
} else { // turn OFF full screen | |
supportActionBar?.show() | |
supportActionBar?.setDisplayShowTitleEnabled(true) | |
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN) | |
window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment