From 9f08c02330953b1561dbe2a46268e0fa8af5c6df Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 2 Oct 2018 16:29:13 +0200 Subject: [PATCH] update the way navigation bar height is calculated --- .../simplemobiletools/gallery/extensions/Context.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index e1a0ab954..dfd694162 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -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