package com.test.basd.onecleanmaster.activity.photocompress.photo

import android.content.Context
import android.content.res.Resources

object Utils {

    fun calculateImageWidth(context: Context): Int {
        val displayMetrics = context.resources.displayMetrics
        val screenWidth = displayMetrics.widthPixels
        return (screenWidth - 14.dpToPx() * 2 - 4.dpToPx() * 2) / 3
    }
    fun Int.dpToPx(): Int {
        val displayMetrics = Resources.getSystem().displayMetrics
        return (this * displayMetrics.density + 0.5f).toInt()
    }

}