From 7007e61879bf33c09115b5d8bc16f27af2731045 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 19 Oct 2019 22:30:16 -0700 Subject: Convert java math to kotlin math --- core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt') 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) } } -- cgit v1.2.3