fix compose button on profile page being half hidden (#2267)

This commit is contained in:
Konrad Pozniak 2021-11-16 21:38:59 +01:00 committed by GitHub
parent 8ccf92de93
commit b62ccd918f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {