diff options
author | Allan Wang <me@allanwang.ca> | 2019-10-19 22:30:16 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-10-19 22:31:14 -0700 |
commit | 7007e61879bf33c09115b5d8bc16f27af2731045 (patch) | |
tree | 19bc5e07f16ce1b6b9d13c711fed5160e25bc3ad /core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt | |
parent | 63f920c3257e955da1ef63c91f8b5e2de5478e55 (diff) | |
download | kau-7007e61879bf33c09115b5d8bc16f27af2731045.tar.gz kau-7007e61879bf33c09115b5d8bc16f27af2731045.tar.bz2 kau-7007e61879bf33c09115b5d8bc16f27af2731045.zip |
Convert java math to kotlin math
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt index 9f23b63..e3baa94 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt @@ -15,6 +15,9 @@ */ package ca.allanwang.kau.swipe +import kotlin.math.max +import kotlin.math.min + /** * Created by Mr.Jude on 2015/8/26. * @@ -46,13 +49,13 @@ internal class RelativeSlider(var curPage: SwipeBackPage) : SwipeListener { } when (edgeFlag) { SWIPE_EDGE_LEFT -> page.swipeBackLayout.x = - Math.min(-offset * Math.max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) + min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) SWIPE_EDGE_RIGHT -> page.swipeBackLayout.x = - Math.min(offset * Math.max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) + min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) SWIPE_EDGE_TOP -> page.swipeBackLayout.y = - Math.min(-offset * Math.max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) + min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) SWIPE_EDGE_BOTTOM -> page.swipeBackLayout.y = - Math.min(offset * Math.max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) + min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) } } |