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.DialogDeviceBinding
import com.zj365.health.databinding.DialogXdBinding

/**
 * 设备选择提示框
 */
class DeviceChooseDialog(context: Context, var start: (status: Int) -> Unit): BaseDialog(context) {

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

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

        //手势选择
        binding.mBlue.isSelected = true
        binding.mBlue.setOnClickListener {
            it.isSelected = true
            binding.m4Glite.isSelected = false
            type= 0

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

    }


}