different method of forcing fullscreen

relates to #3. thanks cvolton for info
This commit is contained in:
qimiko committed 2024-01-16 00:04:54 -07:00
1 parent 6db0c6526a
commit 9b15199882
1 file changed
+1 -23
@@ -231,18 +231,8 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
hideSystemUi()
}
@Suppress("DEPRECATION")
private fun hideSystemUi() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
// window compat is dumb!!
setLegacyVisibility()
window.decorView.setOnSystemUiVisibilityChangeListener { visibility ->
if (visibility and View.SYSTEM_UI_FLAG_FULLSCREEN == 0) {
setLegacyVisibility()
}
}
}
WindowCompat.setDecorFitsSystemWindows(window, false)
WindowCompat.getInsetsController(window, window.decorView).apply {
systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
@@ -250,18 +240,6 @@ class GeometryDashActivity : AppCompatActivity(), Cocos2dxHelper.Cocos2dxHelperL
}
}
@Suppress("DEPRECATION")
private fun setLegacyVisibility() {
// setDecorFitsSystemWindows doesn't hide anything
window.decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_FULLSCREEN or
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
}
override fun onDestroy() {
super.onDestroy()
unregisterReceivers()