blob: 79f80f30708907dda71352f63adbc915dbee1a48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
package ca.allanwang.kau.utils
import android.content.res.Resources
/**
* Created by Allan Wang on 2017-05-28.
*/
fun Int.dpToPx(): Int = (this * Resources.getSystem().displayMetrics.density).toInt()
fun Int.pxToDp(px: Int) = (px / android.content.res.Resources.getSystem().displayMetrics.density).toInt()
|