package kr.co.vividnext.sodalive.extensions

import android.content.res.Resources
import android.util.DisplayMetrics
import java.text.DecimalFormat

fun Float.dpToPx(): Float {
    val metrics = Resources.getSystem().displayMetrics
    return this * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
}

fun Int.dpToPx(): Float {
    val metrics = Resources.getSystem().displayMetrics
    return this.toFloat() * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
}

fun Int.moneyFormat(): String = DecimalFormat("###,###").format(this)
fun Long.moneyFormat(): String = DecimalFormat("###,###").format(this)
