package xn.hxp.ui.main;

import android.view.View;

import com.blankj.utilcode.util.ActivityUtils;

import xn.hxp.databinding.IncludeMainRBinding;
import xn.hxp.room.RoomTool;
import xn.hxp.room.bean.UserInfo;
import xn.hxp.room.dao.DeviceInfoDao;
import xn.hxp.room.tool.UserInfoTool;
import xn.hxp.ui.login.LoginActivity;

public class MainActivityRHelper implements View.OnClickListener {
    private MainActivity mainActivity;
    private IncludeMainRBinding bindingR;
    private UserInfo userInfo;

    public MainActivityRHelper(MainActivity mainActivity, IncludeMainRBinding includeMainRBinding) {
        this.mainActivity = mainActivity;
        this.bindingR = includeMainRBinding;
        setCardClick();
    }

    private void setCardClick() {
        // 存储
        bindingR.save.setOnClickListener(this);
        // 废弃
        bindingR.discard.setOnClickListener(this);
        // 查询
        bindingR.inquire.setOnClickListener(this);
        // 标签
        bindingR.label.setOnClickListener(this);
        // 领用
        bindingR.claim.setOnClickListener(this);
        // 归还
        bindingR.returnAIV.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        userInfo = UserInfoTool.INSTANCE.getUserInfo();
        if (null == userInfo) {
            ActivityUtils.startActivity(LoginActivity.class);
        } else {
            // 存储
            if (v == bindingR.save) {
            }
            // 废弃
            else if (v == bindingR.discard) {
            }
        }
    }
}
