package com.sxyz.rfid.ui.my;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import com.sxyz.rfid.base.BaseFragment;
import com.sxyz.rfid.databinding.FragmentMyBinding;
import com.sxyz.rfid.ui.login.LoginActivity;
import com.sxyz.rfid.utils.LocalUtils;
import com.sxyz.rfid.widgets.AlertDialogUtil;

/**
 * 主要功能: 我的
 *
 * @Description:
 * @Project: rfid-app
 * @Package: com.sxyz.rfid.ui.my.MyFragment
 * @author: chunyuanwu
 * @date: 2025年12月29日 13:00
 * @version: 1.0.0
 */
public class MyFragment extends BaseFragment<FragmentMyBinding> {

    public static Fragment newInstance() {
        return new MyFragment();
    }

    @Override
    public void initParms(Bundle mBundle) {

    }

    @Override
    protected FragmentMyBinding getViewBinding() {
        return FragmentMyBinding.inflate(getLayoutInflater());
    }

    @Override
    protected void initView() {
        mBinding.tvName1.setText(LocalUtils.getNickName());
        mBinding.tvName2.setText(LocalUtils.getUserName());
        /**
         * 退出登录
         */
        mBinding.btnExit.setOnClickListener(v -> {
            new AlertDialogUtil(mActivity).builder().setTitle("提示").setMsg("确定退出登录吗？").setNegativeButton("取消", v1 -> {
            }).setPositiveButton("确定", v12 -> {
                LocalUtils.clearSp();
                startActivity(LoginActivity.class);
                getActivity().finish();
            }).show();
        });
    }

    @Override
    protected void setListener() {

    }

    @Override
    protected void initData() {

    }
}
