More bottom inset padding fixes

This commit is contained in:
arkon
2020-11-27 21:05:06 -05:00
parent 10163aab21
commit 776f6a9a16
13 changed files with 23 additions and 37 deletions
@@ -38,15 +38,12 @@ fun Controller.withFadeTransaction(): RouterTransaction {
val Controller.insets: WindowInsets?
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activity!!.window.decorView.rootWindowInsets
activity?.window?.decorView?.rootWindowInsets
} else {
null
}
inline fun Controller.applyBottomInsetPadding(view: View, paddingBottom: Int = view.paddingBottom) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
view.updatePadding(bottom = paddingBottom + insets!!.systemWindowInsetBottom)
} else {
view.updatePadding(bottom = paddingBottom)
}
fun Controller.applyBottomInsetPadding(view: View, paddingBottom: Int = view.paddingBottom) {
val bottomInset = insets?.systemWindowInsetBottom ?: 0
view.updatePadding(bottom = paddingBottom + bottomInset)
}