Skip to content

Commit

Permalink
Returns statusbar height if not actionbar is present
Browse files Browse the repository at this point in the history
  • Loading branch information
elek90 committed May 30, 2018
1 parent 073bb84 commit 26752c3
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ internal fun Activity.getStatusBarHeightInPx(): Int {

val statusBarHeight = rectangle.top
val contentViewTop = window.findViewById<View>(Window.ID_ANDROID_CONTENT).top

return contentViewTop - statusBarHeight
return if (contentViewTop == 0) { //Actionbar is not present
statusBarHeight
} else {
contentViewTop - statusBarHeight
}
}

internal fun Activity.getNavigationBarPosition(): NavigationBarPosition {
Expand Down

0 comments on commit 26752c3

Please sign in to comment.