diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt index adcdcac6..5043d47c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt @@ -38,6 +38,7 @@ import androidx.core.view.ViewCompat import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat.Type.systemBars +import androidx.core.view.updatePadding import androidx.emoji.text.EmojiCompat import androidx.preference.PreferenceManager import androidx.recyclerview.widget.LinearLayoutManager @@ -141,6 +142,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI animateEmojis = sharedPrefs.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false) hideFab = sharedPrefs.getBoolean("fabHide", false) + handleWindowInsets() setupToolbar() setupTabs() setupAccountViews() @@ -245,15 +247,20 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI }) } - private fun setupToolbar() { - // set toolbar top margin according to system window insets + private fun handleWindowInsets() { ViewCompat.setOnApplyWindowInsetsListener(binding.accountCoordinatorLayout) { _, insets -> val top = insets.getInsets(systemBars()).top val toolbarParams = binding.accountToolbar.layoutParams as ViewGroup.MarginLayoutParams toolbarParams.topMargin = top + + val bottom = insets.getInsets(systemBars()).bottom + binding.accountCoordinatorLayout.updatePadding(bottom = bottom) + WindowInsetsCompat.CONSUMED } + } + private fun setupToolbar() { // Setup the toolbar. setSupportActionBar(binding.accountToolbar) supportActionBar?.run {