update the way navigation bar height is calculated

This commit is contained in:
tibbi 2018-10-02 16:29:13 +02:00
parent c547cb3890
commit 9f08c02330
1 changed files with 11 additions and 1 deletions

View File

@ -45,10 +45,20 @@ val Context.navigationBarWidth: Int get() = if (navigationBarRight) navigationBa
internal val Context.navigationBarSize: Point
get() = when {
navigationBarRight -> Point(realScreenSize.x - usableScreenSize.x, usableScreenSize.y)
navigationBarBottom -> Point(usableScreenSize.x, realScreenSize.y - usableScreenSize.y)
navigationBarBottom -> Point(usableScreenSize.x, newNavigationBarHeight)
else -> Point()
}
internal val Context.newNavigationBarHeight: Int
get() {
var navigationBarHeight = 0
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
if (resourceId > 0) {
navigationBarHeight = resources.getDimensionPixelSize(resourceId)
}
return navigationBarHeight
}
internal val Context.statusBarHeight: Int
get() {
var statusBarHeight = 0