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 /colorpicker/src/main/kotlin/ca | |
parent | 63f920c3257e955da1ef63c91f8b5e2de5478e55 (diff) | |
download | kau-7007e61879bf33c09115b5d8bc16f27af2731045.tar.gz kau-7007e61879bf33c09115b5d8bc16f27af2731045.tar.bz2 kau-7007e61879bf33c09115b5d8bc16f27af2731045.zip |
Convert java math to kotlin math
Diffstat (limited to 'colorpicker/src/main/kotlin/ca')
-rw-r--r-- | colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt index 29257d8..39fb1cf 100644 --- a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt +++ b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/CircleView.kt @@ -41,6 +41,7 @@ import ca.allanwang.kau.utils.getDip import ca.allanwang.kau.utils.setBackgroundColorRes import ca.allanwang.kau.utils.toColor import ca.allanwang.kau.utils.toHSV +import kotlin.math.roundToInt /** * Created by Allan Wang on 2017-06-10. @@ -214,7 +215,7 @@ class CircleView @JvmOverloads constructor(context: Context, attrs: AttributeSet @ColorInt fun translucentColor(color: Int): Int { val factor = 0.7f - val alpha = Math.round(Color.alpha(color) * factor) + val alpha = (Color.alpha(color) * factor).roundToInt() val red = Color.red(color) val green = Color.green(color) val blue = Color.blue(color) |