fun Int.sdp(): Dp {
val screenDp =
Resources.getSystem().displayMetrics.widthPixels / Resources.getSystem().displayMetrics.density
return (this.toFloat() / 750 * screenDp).dp
}
fun Double.sdp(): Dp {
val screenDp =
Resources.getSystem().displayMetrics.widthPixels / Resources.getSystem().displayMetrics.density
return (this / 750 * screenDp).toInt().dp
}
fun Int.ssp(): TextUnit {
val screenDp =
Resources.getSystem().displayMetrics.widthPixels / Resources.getSystem().displayMetrics.density
return (this.toFloat() / 750 * screenDp).sp
}
fun Double.ssp(): TextUnit {
val screenDp =
Resources.getSystem().displayMetrics.widthPixels / Resources.getSystem().displayMetrics.density
return (this.toFloat() / 750 * screenDp).sp
}