package com.gamedog.vididin.main

import android.app.Activity
import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.architecture.widget.BindingDialog
import com.gamedog.vididin.databinding.DialogWatchVideoBinding
import com.gamedog.vididin.router.Router


class WatchAdDialog(context: Activity, private val mTaskType: Int,
                    private val mTaskDataJson: String?)
    : BindingDialog<DialogWatchVideoBinding>(context, DialogWatchVideoBinding::inflate) {

    init {
        build()
    }


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

        mBinding.run {
            setOnClickBatch(flAction, ivClose) {
                when (this) {
                    ivClose ->  {
                        dismiss()
                    }
                    flAction ->  {
                        gotoWatchVideo()
                    }
                }
            }
        }
    }

    private fun gotoWatchVideo() {
        Router.WatchAd.startActivity(mActivity, mTaskType, mTaskDataJson)
        dismiss()
    }



}

