aboutsummaryrefslogtreecommitdiff
path: root/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-18 20:16:23 -0700
committerGitHub <noreply@github.com>2017-07-18 20:16:23 -0700
commit8f2b5ac043f47cc44f43c3788d1377083fb339a2 (patch)
tree8f91042414de211cbfe67a76298300884f46a765 /core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
parent4eee8d59c21b2061b9f5fd0e805ca60ab84c3585 (diff)
downloadkau-8f2b5ac043f47cc44f43c3788d1377083fb339a2.tar.gz
kau-8f2b5ac043f47cc44f43c3788d1377083fb339a2.tar.bz2
kau-8f2b5ac043f47cc44f43c3788d1377083fb339a2.zip
Dev 2.1 (#8)
* Rewrite animation interfaces * Update changelog * Add scale factor for slide * Remove margins in iitems and replace with decorators * Remove mutable list * Switch cardiitem to use lambdas for click * status * Utils update and imagepicker fixes * Remove stringholder * Add fade in fade out * Increment about version * Rename fromedge to direction in javadocs * More logging * Add logging and docs * Make card icons visible * Update email builder and icon padding * Create elastic recycler activity * Fix card iitem * Add lint check and plurals * Inline all the things * Format and sort xml * Update dependencies and increment version
Diffstat (limited to 'core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt')
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt6
1 files changed, 4 insertions, 2 deletions
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
index 42f19b9..9e8ac11 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/views/CutoutView.kt
@@ -27,7 +27,7 @@ import android.view.View
import ca.allanwang.kau.ui.R
import ca.allanwang.kau.utils.dimenPixelSize
import ca.allanwang.kau.utils.getFont
-import ca.allanwang.kau.utils.parentVisibleHeight
+import ca.allanwang.kau.utils.parentViewGroup
import ca.allanwang.kau.utils.toBitmap
/**
@@ -66,6 +66,7 @@ class CutoutView @JvmOverloads constructor(
private var heightPercentage: Float = 0f
private var minHeight: Float = 0f
private val maxTextSize: Float
+ private val parentFrame = Rect()
init {
if (attrs != null) {
@@ -121,7 +122,8 @@ class CutoutView @JvmOverloads constructor(
* If height percent is specified, ensure it is met
*/
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
- val minHeight = Math.max(minHeight, heightPercentage * parentVisibleHeight)
+ parentViewGroup.getWindowVisibleDisplayFrame(parentFrame)
+ val minHeight = Math.max(minHeight, heightPercentage * parentFrame.height())
val trueHeightMeasureSpec = if (minHeight > 0)
MeasureSpec.makeMeasureSpec(Math.max(minHeight.toInt(), measuredHeight), MeasureSpec.EXACTLY)
else heightMeasureSpec