fix compose button on profile page being half hidden (#2267)
This commit is contained in:
parent
8ccf92de93
commit
b62ccd918f
1 changed files with 9 additions and 2 deletions
|
@ -38,6 +38,7 @@ import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsCompat.Type.systemBars
|
import androidx.core.view.WindowInsetsCompat.Type.systemBars
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import androidx.emoji.text.EmojiCompat
|
import androidx.emoji.text.EmojiCompat
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
@ -141,6 +142,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
|
||||||
animateEmojis = sharedPrefs.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false)
|
animateEmojis = sharedPrefs.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false)
|
||||||
hideFab = sharedPrefs.getBoolean("fabHide", false)
|
hideFab = sharedPrefs.getBoolean("fabHide", false)
|
||||||
|
|
||||||
|
handleWindowInsets()
|
||||||
setupToolbar()
|
setupToolbar()
|
||||||
setupTabs()
|
setupTabs()
|
||||||
setupAccountViews()
|
setupAccountViews()
|
||||||
|
@ -245,15 +247,20 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupToolbar() {
|
private fun handleWindowInsets() {
|
||||||
// set toolbar top margin according to system window insets
|
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(binding.accountCoordinatorLayout) { _, insets ->
|
ViewCompat.setOnApplyWindowInsetsListener(binding.accountCoordinatorLayout) { _, insets ->
|
||||||
val top = insets.getInsets(systemBars()).top
|
val top = insets.getInsets(systemBars()).top
|
||||||
val toolbarParams = binding.accountToolbar.layoutParams as ViewGroup.MarginLayoutParams
|
val toolbarParams = binding.accountToolbar.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
toolbarParams.topMargin = top
|
toolbarParams.topMargin = top
|
||||||
|
|
||||||
|
val bottom = insets.getInsets(systemBars()).bottom
|
||||||
|
binding.accountCoordinatorLayout.updatePadding(bottom = bottom)
|
||||||
|
|
||||||
WindowInsetsCompat.CONSUMED
|
WindowInsetsCompat.CONSUMED
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupToolbar() {
|
||||||
// Setup the toolbar.
|
// Setup the toolbar.
|
||||||
setSupportActionBar(binding.accountToolbar)
|
setSupportActionBar(binding.accountToolbar)
|
||||||
supportActionBar?.run {
|
supportActionBar?.run {
|
||||||
|
|
Loading…
Reference in a new issue