Luke Waggoner

Results 2 comments of Luke Waggoner

I personally would go with the following methods: fun Number.toDp(displayMetrics: DisplayMetrics? = null): Float = this.toFloat() / ((displayMetrics ?: Resources.getSystem().displayMetrics).densityDpi / 160f) fun Number.toPx(displayMetrics: DisplayMetrics? = null) : Float =...

What would make it error prone? The only reason you'd ever need to specify displayMetrics would be if you have more than one display. That's never happened to me. On...