From c187d247e72cec772e891383c22be01927807311 Mon Sep 17 00:00:00 2001 From: Naveen Date: Wed, 10 May 2023 22:44:44 +0530 Subject: [PATCH] Only apply insets when using gesture navigation --- .../commons/activities/BaseSimpleActivity.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt index 4853bb8fe..00679ca68 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/activities/BaseSimpleActivity.kt @@ -158,6 +158,7 @@ abstract class BaseSimpleActivity : AppCompatActivity() { hideKeyboard() finish() } + else -> return super.onOptionsItemSelected(item) } return true @@ -228,14 +229,14 @@ abstract class BaseSimpleActivity : AppCompatActivity() { if (navigationBarHeight > 0 || isUsingGestureNavigation()) { window.decorView.systemUiVisibility = window.decorView.systemUiVisibility.addBit(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) updateTopBottomInsets(statusBarHeight, navigationBarHeight) + onApplyWindowInsets { + val insets = it.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime()) + updateTopBottomInsets(insets.top, insets.bottom) + } } else { window.decorView.systemUiVisibility = window.decorView.systemUiVisibility.removeBit(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) updateTopBottomInsets(0, 0) } - onApplyWindowInsets { - val insets = it.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime()) - updateTopBottomInsets(insets.top, insets.bottom) - } } }