package com.gh.common.util

import android.content.Context
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.common.utils.NetworkUtils
import com.lightgame.utils.Utils
import com.zhihu.matisse.filter.ApplyFilter
import com.zhihu.matisse.internal.entity.Item

class GhMatisseVideoApplyFilter : ApplyFilter() {

    override fun applyFiltering(context: Context, itemList: MutableList<Item>, callBack: OnApplyFilterCallBack) {
        if (!NetworkUtils.isNetworkConnected(context)) {
            Utils.toast(context, "网络异常，请检查手机网络状态")
        } else if (!NetworkUtils.isWifiConnected(context)) {
            DialogHelper.showDialog(context, "提示",
                "您当前正在使用移动网络上传视频，确定继续上传吗？",
                "继续上传", "暂时不了",
                { callBack.onApply() }, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
            )
        } else {
            callBack.onApply()
        }
    }
}