package com.gamedog.vididin.features.withdraw.dialogs


import android.app.Activity
import com.ama.core.architecture.util.AndroidUtil
import com.ama.core.architecture.util.eventbus.NotifyMan
import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.architecture.widget.BindingDialog
import com.gamedog.vididin.VidiConst
import com.gamedog.vididin.router.Router
import com.viddin.videos.free.R
import com.viddin.videos.free.databinding.DialogWithdrawWatchAdBinding as ViewBinding


class WithdrawWatchAdDialog(context: Activity, private var mWithdrawCashNum: Float) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {


    init {
        build()
    }


    private fun build() {
        with()
        setCenter()
        setMaskValue(0.8f)
        setCanCancel(false)

        mBinding.run {
            progressBar.setBarColor(R.color.blue_ba, R.color.blue_ff)
            tvCashNum.text = mWithdrawCashNum.toString()

            setOnClickBatch(flAction, ivClose) {
                when (this) {
                    ivClose ->  {
                        dismiss()
                    }

                    flAction ->  {
                        gotoWatchVideo()
                        dismiss()
                    }
                }
            }
        }
    }


    private fun gotoWatchVideo() {
        Router.WatchAd.startActivity(mActivity, VidiConst.WATCH_AD_FOR_WITHDRAW_SMALL, AndroidUtil.object2Json(mWithdrawCashNum))
    }




}

