aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-01-19 21:53:22 -0800
committerAllan Wang <me@allanwang.ca>2020-01-19 21:53:22 -0800
commita94461333c058a5e9299d21b9b2f0daa5c647874 (patch)
tree921160e0468a37d19129c47626093e1d557ebc71
parentc2710cfcaf06f3dbd3a912a6231c170ee6cd6a45 (diff)
parent7e88af5bdfe5fa7da793383045f71b702c38ba1f (diff)
downloadkau-a94461333c058a5e9299d21b9b2f0daa5c647874.tar.gz
kau-a94461333c058a5e9299d21b9b2f0daa5c647874.tar.bz2
kau-a94461333c058a5e9299d21b9b2f0daa5c647874.zip
Merge branch 'progress-animator' into dev
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
index 4757a00..556c01c 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt
@@ -88,6 +88,15 @@ inline val View.isInvisible: Boolean
inline val View.isGone: Boolean
get() = visibility == View.GONE
+/**
+ * Measure the height of a view if it had match_parent for width and no height restrictions
+ */
+inline val View.unboundedHeight: Int
+ get() {
+ measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
+ return measuredHeight
+ }
+
@KauUtils
inline fun View.setBackgroundColorRes(@ColorRes color: Int) =
setBackgroundColor(context.color(color))