package com.xty.base.h5

import com.xty.base.utils.ContextUtils
import com.xty.base.utils.SystemBarHelper
import com.xty.base.utils.SystemBarHelper.getStatusBarHeight


object WebUtils {
    private var mSbar = -1

    /**
     * 获取状态栏高度
     *
     * @return 状态栏高度px
     */
    @Synchronized
    fun getStatesBar(): Int {
        if (mSbar < 0) {
            mSbar = getStatusBarHeight(ContextUtils.getContext())
        }
        return mSbar
    }


    @Synchronized
    fun getDensityDpi(): Int {
        val displayMetrics = ContextUtils.getContext().resources.displayMetrics
        return displayMetrics.density.toInt()
    }
}