From 57be0ba91387a18d70ff073d4b6c538bc9f6f745 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Mon, 24 Jan 2022 17:50:22 +0000 Subject: [PATCH] making use of roundToInt to avoid separate rounding and toInt --- vector/src/main/java/im/vector/app/core/extensions/Context.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/core/extensions/Context.kt b/vector/src/main/java/im/vector/app/core/extensions/Context.kt index 37c3ae927f..a2e8e05273 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/Context.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/Context.kt @@ -26,6 +26,7 @@ import androidx.core.content.ContextCompat import dagger.hilt.EntryPoints import im.vector.app.core.di.SingletonEntryPoint import kotlin.math.round +import kotlin.math.roundToInt fun Context.singletonEntryPoint(): SingletonEntryPoint { return EntryPoints.get(applicationContext, SingletonEntryPoint::class.java) @@ -45,5 +46,5 @@ fun Context.getTintedDrawable(@DrawableRes drawableRes: Int, @ColorInt tint: Int } private fun Float.toAndroidAlpha(): Int { - return round(this * 255).toInt() + return (this * 255).roundToInt() }