package com.swago.room.dialog

import android.os.Bundle
import android.view.Gravity
import com.alibaba.android.arouter.launcher.ARouter
import com.swago.baseswago.constant.ARouteConstant
import com.swago.baseswago.dialog.BaseXDFragment
import com.swago.baseswago.util.NoDoubleClickListener
import com.swago.room.databinding.DialogUnreachLevelBinding

class UnReachLevelDialog : BaseXDFragment<DialogUnreachLevelBinding>() {

    init {
        setGravity(Gravity.CENTER)
        setDimAmount(0.5f)
        setCanCancel(true)
    }

    companion object{
        fun newInstance(content:String): UnReachLevelDialog {
            val args = Bundle()
            args.putString("msg",content)
            val fragment = UnReachLevelDialog()
            fragment.arguments = args
            return fragment
        }
    }

    override fun initOther() {
        arguments?.let {
            val msg = it.getString("msg","")
            binding.tvContent.text = msg
        }

        binding.tvUpgradeLevel.setOnClickListener(object:NoDoubleClickListener(){
            override fun onClick() {
                ARouter.getInstance().build(ARouteConstant.User.level).navigation()
                dismissAllowingStateLoss()
            }
        })
    }

    override fun initLiveData() {
    }
}