package com.dlc.laboratory.ui.things

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.dlc.eboard.databinding.FragmentSelectAuthMethodBinding
import com.dlc.eboard.ui.auth.fragment.FaceAuthFragment
import com.dlc.eboard.ui.sign.SignInFragmentCallback
import com.dlc.eboard.ui.auth.fragment.CardAuthFragment
import com.rc.core.ui.fragment.RcBaseFragment

/**
 * info
 *
 * @author ReiChin_
 */
class SelectAuthMethodFragment : RcBaseFragment<FragmentSelectAuthMethodBinding>() {

    private var mFragmentCallback: SignInFragmentCallback? = null

    override fun onAttach(context: Context) {
        super.onAttach(context)
        mFragmentCallback = context as? SignInFragmentCallback
    }

    override fun onDetach() {
        super.onDetach()
        mFragmentCallback = null
    }

    override fun createViewBinding(
        inflater: LayoutInflater,
        container: ViewGroup?
    ): FragmentSelectAuthMethodBinding {
        return FragmentSelectAuthMethodBinding.inflate(inflater, container, false)
    }

    override fun initViews(savedInstanceState: Bundle?) {
        viewBinding.faceDetect.setOnClickListener {
            // 人脸识别
            mFragmentCallback?.switchFragment(FaceAuthFragment())
        }

        viewBinding.schoolCard.setOnClickListener {
            // 校园卡
            mFragmentCallback?.switchFragment(CardAuthFragment.newInstance())
        }
    }

}