Skip to content

Commit

Permalink
making use of roundToInt to avoid separate rounding and toInt
Browse files Browse the repository at this point in the history
  • Loading branch information
ouchadam committed Jan 24, 2022
1 parent f8e65f5 commit 57be0ba
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}

0 comments on commit 57be0ba

Please sign in to comment.