package com.android.common.utils;

/**
 * @author 910040
 * @version V1.0
 * @date 2019/5/21 15:48
 */
public class DensityUtils {

    public static float dp2px(float dipValue) {
        float scale = AppUtils.getAppContext().getResources().getDisplayMetrics().density;
        return  dipValue * scale + 0.5f;
    }

    public static float px2dp(float pxValue) {
        final float scale = AppUtils.getAppContext().getResources().getDisplayMetrics().density;
        return pxValue / scale + 0.5f;
    }
}
