package com.zj365.mime.weight

import android.content.Context
import android.view.Gravity
import com.xty.base.dialog.BaseDialog
import com.xty.common.bracelet.YCBOrder
import com.zj365.mime.R
import com.zj365.mime.databinding.DialogLightBinding

class LightDialog(context: Context,var type:(status:Int,str:String)->Unit) : BaseDialog(context, R.style.CustomDialog) {
    val binding by lazy { DialogLightBinding.inflate(layoutInflater) }


    override fun setLayout() = binding.root
    override fun initView() {
        super.initView()
        window!!.setGravity(Gravity.BOTTOM)
        window!!.setWindowAnimations(R.style.dialog_bottom)

        setCancelable(true)
        setCanceledOnTouchOutside(true)

        //手势选择
        binding.mLow.isSelected = true
        binding.mLow.setOnClickListener {
            it.isSelected = true
            binding.mCenter.isSelected = false
            binding.mHeight.isSelected = false
            type.invoke(YCBOrder.LIGHT_1,"低")
            dismiss()
        }
        binding.mCenter.setOnClickListener {
            it.isSelected = true
            binding.mLow.isSelected = false
            binding.mHeight.isSelected = false
            type.invoke(YCBOrder.LIGHT_2,"中")
            dismiss()
        }
        binding.mHeight.setOnClickListener {
            it.isSelected = true
            binding.mCenter.isSelected = false
            binding.mLow.isSelected = false
            type.invoke(YCBOrder.LIGHT_3,"高")
            dismiss()
        }

    }


}