internal fun Activity.getStatusBarHeightInPx(): Int {
val rectangle = Rect()
window.decorView.getWindowVisibleDisplayFrame(rectangle)
val statusBarHeight = rectangle.top
val contentViewTop = window.findViewById<View>(Window.ID_ANDROID_CONTENT).top
return if (contentViewTop == 0) { //Actionbar is not present
statusBarHeight
} else {
contentViewTop - statusBarHeight
}
}
internal fun Activity.getStatusBarHeightInPx(): Int {
val rectangle = Rect()
}