package com.adealink.weparty.commonui

import android.content.Context
import com.adealink.frame.aab.util.getCompatString
import com.adealink.weparty.R
import com.adealink.weparty.commonui.ext.dp
import com.scwang.smart.refresh.footer.ClassicsFooter
import com.scwang.smart.refresh.layout.SmartRefreshLayout

object WEUI {

    fun init(ctx: Context) {
        //设置全局的Header构建器
        SmartRefreshLayout.setDefaultRefreshHeaderCreator { context, layout ->
//            layout.setPrimaryColorsId(R.color.color_app_main_btn_text, R.color.white) //全局设置主题颜色
            layout.setHeaderHeightPx(70.dp()) //默认100ddp
//            layout.setDragRate(1f)
//            MaterialHeader(context)
            SVGARefreshHeader(context)
        }
        //设置全局的Footer构建器
        SmartRefreshLayout.setDefaultRefreshFooterCreator { context, _ -> //指定为经典Footer，默认是 BallPulseFooter
            ClassicsFooter.REFRESH_FOOTER_PULLING = getCompatString(R.string.commonui_srl_footer_pulling)
            ClassicsFooter.REFRESH_FOOTER_RELEASE = getCompatString(R.string.commonui_srl_footer_release)
            ClassicsFooter.REFRESH_FOOTER_LOADING = getCompatString(R.string.commonui_srl_footer_loading)
            ClassicsFooter.REFRESH_FOOTER_REFRESHING = getCompatString(R.string.commonui_srl_footer_refreshing)
            ClassicsFooter.REFRESH_FOOTER_FINISH = getCompatString(R.string.commonui_srl_footer_finish)
            ClassicsFooter.REFRESH_FOOTER_FAILED = getCompatString(R.string.commonui_srl_footer_failed)
            ClassicsFooter.REFRESH_FOOTER_NOTHING = getCompatString(R.string.commonui_srl_footer_nothing)
            ClassicsFooter(context).setDrawableSize(20f)
        }
    }

}