diff options
author | Allan Wang <me@allanwang.ca> | 2020-01-19 21:46:16 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-19 21:46:16 -0800 |
commit | 7e88af5bdfe5fa7da793383045f71b702c38ba1f (patch) | |
tree | 921160e0468a37d19129c47626093e1d557ebc71 | |
parent | b7fd1c5c7e848d7cf12c49a1e9e319d4e11d0b5c (diff) | |
parent | 7bb55f260763f19f1f651e61711c0f171148c1c0 (diff) | |
download | kau-7e88af5bdfe5fa7da793383045f71b702c38ba1f.tar.gz kau-7e88af5bdfe5fa7da793383045f71b702c38ba1f.tar.bz2 kau-7e88af5bdfe5fa7da793383045f71b702c38ba1f.zip |
Merge pull request #242 from AllanWang/misc
Misc
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt | 9 |
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)) |