package com.rdiot.yx485.ui.bind

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import com.king.zxing.util.LogUtils
import com.rdiot.yx485.R
import com.rdiot.yx485.base.BaseFragment
import com.rdiot.yx485.base.BindModelFactory
import com.rdiot.yx485.databinding.FraResetBinding
import com.rdiot.yx485.ui.bind.model.BindViewModel
import com.rdiot.yx485.util.setClickLimitListener

/**
 * 复位设备提示页
 * @author mR2hao
 * @date 2022/11/21
 */
class ResetFragment : BaseFragment<FraResetBinding>() {
    override fun getLayoutId() = R.layout.fra_reset
    private val bindViewModel: BindViewModel by activityViewModels { BindModelFactory() }

    @SuppressLint("MissingPermission")
    override fun initView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ) {
        LogUtils.e("绑定的数据：${bindViewModel.deviceTypeId.get()!!}")

        binding.btnNext.setClickLimitListener {
            findNavController().navigate(R.id.action_resetFragment_to_enterRoomInfoFragment)
        }
        binding.vm = bindViewModel

    }

    override fun onResume() {
        super.onResume()
        (act as BindActivity).setNBTitle(getString(R.string.add_room))
    }
}