making use of roundToInt to avoid separate rounding and toInt

This commit is contained in:
Adam Brown 2022-01-24 17:50:22 +00:00
parent f8e65f5872
commit 57be0ba913

View file

@ -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()
}