fix compose button on profile page being half hidden (#2267)
This commit is contained in:
parent
8ccf92de93
commit
b62ccd918f
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue