srctree

Robin Linden parent df31ed89 26d8ef09
Get rid of untyped dpToPx conversion function

This was only used as a helper for the typed Dp -> Px conversion anyway,so no point in keeping it as a helper accessible to the rest of thecode.

inlinesplit
atox/src/main/kotlin/ui/Util.kt added: 3, removed: 5, total 0
@@ -17,9 +17,6 @@ internal fun colorFromStatus(context: Context, status: UserStatus) = when (statu
UserStatus.Busy -> ContextCompat.getColor(context, R.color.statusBusy)
}
 
internal fun dpToPx(dp: Float, res: Resources): Int =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, res.displayMetrics).toInt()
 
internal sealed interface Size
 
@JvmInline
@@ -27,5 +24,6 @@ internal value class Px(val px: Int) : Size
 
@JvmInline
internal value class Dp(val dp: Float) : Size {
fun asPx(res: Resources): Px = Px(dpToPx(dp, res))
fun asPx(res: Resources): Px =
Px(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, res.displayMetrics).toInt())
}