package com.zj365.health.weight

import android.content.Context
import com.xty.base.dialog.BaseDialog
import com.xty.common.bracelet.YCBOrder
import com.zj365.health.databinding.DialogXdBinding

/**
 * 心电监测提示框
 */
class XdDialog(context: Context,var start: (status: Int) -> Unit): BaseDialog(context) {

    private var type=0
    val binding by lazy { DialogXdBinding.inflate(layoutInflater)  }
    override fun setLayout()=binding.root

    override fun initView() {
        super.initView()
        percentHeight=2/3f
        setDialogPadding(40,0,40,0)
        binding.mStart.setOnClickListener {
            start.invoke(type)
            dismiss()
        }

        //手势选择
        binding.mLeft.isSelected = true
        binding.mLeft.setOnClickListener {
            it.isSelected = true
            binding.mRight.isSelected = false
            type= YCBOrder.LEFT_HAND

        }
        binding.mRight.setOnClickListener {
            it.isSelected = true
            binding.mLeft.isSelected = false
            type=YCBOrder.RIGHT_HAND
        }
    }
    fun showHand(showLoc: Int) {
        showDialog()
        when (showLoc) {
            0 -> {
                binding.mLeft.isSelected = true
                binding.mRight.isSelected = false
            }
            1 -> {
                binding.mRight.isSelected = true
                binding.mLeft.isSelected = false
            }
        }

    }


}