package com.xty.common.recycleUtils

import android.content.Context
import android.content.res.Resources
import android.graphics.Rect
import android.view.Display
import android.view.WindowManager
import androidx.recyclerview.widget.RecyclerView
import com.realsil.sdk.core.utility.DeviceUtils


class GalleryItemDecoration: RecyclerView.ItemDecoration() {
    /**
     * 自定义默认的Item的边距
     */
    private val mPageMargin = 10

    /**
     * 第一张图片的左边距
     */
    private var mLeftPageVisibleWidth = 0



    /**
     * 获取屏幕的宽度
     * @param context:
     * @return :
     */
    fun getScreenWidth(context: Context): Int {
        val manager: WindowManager = context
            .getSystemService(Context.WINDOW_SERVICE) as WindowManager
        val display: Display = manager.getDefaultDisplay()
        return display.getWidth()
    }



    /**
     * d p转换成px
     * @param dp：
     */
        fun dpToPx(dp: Int): Int {
        return (dp * Resources.getSystem().getDisplayMetrics().density + 0.5f).toInt()
    }
}