Merge pull request #525 from trubitsyn/patch-2

Resources.getActionBarHeight() fix return style
This commit is contained in:
Tibor Kaputa 2017-12-25 23:10:05 +01:00 committed by GitHub
commit 49922159e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,11 +6,10 @@ import android.util.TypedValue
fun Resources.getActionBarHeight(context: Context): Int { fun Resources.getActionBarHeight(context: Context): Int {
val tv = TypedValue() val tv = TypedValue()
var height = 0 return if (context.theme.resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
if (context.theme.resolveAttribute(android.R.attr.actionBarSize, tv, true)) { TypedValue.complexToDimensionPixelSize(tv.data, displayMetrics)
height = TypedValue.complexToDimensionPixelSize(tv.data, displayMetrics) } else
} 0
return height
} }
fun Resources.getStatusBarHeight(): Int { fun Resources.getStatusBarHeight(): Int {