Fix app for landscape phones with 3 button nav

This commit is contained in:
Jays2Kings 2021-03-26 12:49:17 -04:00
parent 46374e0582
commit 0c41a3cd96
2 changed files with 15 additions and 0 deletions

View File

@ -224,6 +224,17 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
bottom_view.gone()
content.doOnApplyWindowInsets { v, insets, _ ->
setNavBarColor(insets)
val contextView = window?.decorView?.findViewById<View>(R.id.action_mode_bar)
contextView?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = insets.systemWindowInsetLeft
rightMargin = insets.systemWindowInsetRight
}
// Consume any horizontal insets and pad all content in. There's not much we can do
// with horizontal insets
v.updatePadding(
left = insets.systemWindowInsetLeft,
right = insets.systemWindowInsetRight
)
appbar.updatePadding(
top = insets.systemWindowInsetTop
)

View File

@ -265,6 +265,10 @@ fun BottomSheetDialog.setEdgeToEdge(
contentView.post {
(contentView.parent as View).background = null
}
contentView.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = insets.systemWindowInsetLeft
rightMargin = insets.systemWindowInsetRight
}
if (setTopMargin > 0) (contentView.parent as View).updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = activity.window.decorView.height - insets.systemWindowInsetTop - setTopMargin
}