package com.doumee.keyCabinet.utils; import android.text.TextUtils; import com.doumee.lib_coremodel.util.SpUtil; /** * 手环机日志 */ public class BraceletLogUtils { private static final String LOG_KEY = "bracelet_log"; public static Long COUNT = 0L; public static Long OUT_COUNT = 0L; public static Long lastTime = 0L; public static void saveLog(String msg){ String time = TimeUtils.getNowDate(); String text = SpUtil.getString(LOG_KEY); if(TextUtils.isEmpty(text)){ text = ""; } text+= time + ":"+msg+" #"; COUNT++; SpUtil.saveString(LOG_KEY,text); } /** * 取出所有记录 * @return */ public static String getAllLog(){ OUT_COUNT = COUNT; String text = SpUtil.getString(LOG_KEY); SpUtil.saveString(LOG_KEY,""); COUNT = 0L; return text; } public static void backLog(String msg){ String text = SpUtil.getString(LOG_KEY); if(TextUtils.isEmpty(text)){ text = ""; } text = msg + text; COUNT += OUT_COUNT; OUT_COUNT = 0L; SpUtil.saveString(LOG_KEY,text); } }