package com.wd.workoffice.util;


import flexible.xd.android_base.utils.SPUtils;

/**
 * Created by Flexible on 2017/1/9 0009.
 */

public class DataKeeper {
    private volatile static DataKeeper keeper;
    private SPUtils sp = SPUtils.getInstance("DataKeeper");
    private final String MES_MENU_ID = "MES_MENU_ID";
    private final String MES_MENU = "MES_MENU";
    private final String MSG_STATUS = "MSG_STATUS";

    private DataKeeper() {
    }

    public static DataKeeper getInstance() {
        if (keeper == null) {
            synchronized (DataKeeper.class) {
                if (keeper == null) {
                    keeper = new DataKeeper();
                }
            }
        }
        return keeper;
    }

    /**
     * mes菜单
     *
     * @param info
     */
    public void keepMenu(String info) {
        sp.put(MES_MENU, info);
    }

    public String getMenu() {
        return sp.getString(MES_MENU);
    }

    public void clearMenu() {
        sp.put(MES_MENU, "");
    }

    /**
     * 消息红点状态
     *
     * @param info
     */
    public void keepMsgStatus(Boolean info) {
        sp.put(MSG_STATUS, info);
    }

    public Boolean getMsgStatus() {
        return sp.getBoolean(MSG_STATUS);
    }

    public void clearMsgStatus() {
        sp.put(MSG_STATUS, false);
    }


//    /**
//     * mes菜单id
//     *
//     * @param info
//     */
//    public void keepMenuId(String info) {
//        sp.put(MES_MENU_ID, info);
//    }
//
//    public String getMenuId() {
//        return sp.getString(MES_MENU_ID);
//    }
//
//    public void clearMenuId() {
//        sp.put(MES_MENU_ID, "");
//    }

    public void clearAll() {
        clearMenu();
        clearMsgStatus();
    }
}
