增加人脸采集功能;
识别人脸成功后打开有餐盘的第一个柜子; 扫码打开已绑定的柜子,无则打开第一个空柜子并放入餐盘; 设置页面问题优化;
This commit is contained in:
@@ -1,20 +1,42 @@
|
||||
package com.sw.platecabinet.utils;
|
||||
package com.sw.platecabinet.utils
|
||||
|
||||
import com.sw.inbound.utils.SPUtil;
|
||||
import com.sw.platecabinet.MyApp;
|
||||
import com.google.gson.Gson
|
||||
import com.sw.inbound.utils.GsonUtils
|
||||
import com.sw.inbound.utils.SPUtil
|
||||
import com.sw.inbound.utils.SPUtil.Companion.getInstance
|
||||
import com.sw.platecabinet.MyApp
|
||||
import com.sw.platecabinet.model.response.EquipmentUserInfo
|
||||
|
||||
public class SpTool {
|
||||
object SpTool {
|
||||
const val LAST_FACE_TIMESTAMP: String = "faceTimestamp"
|
||||
const val PLATE_BOX_DATA: String = "plateBoxBind"
|
||||
private var spUtil: SPUtil? = null
|
||||
|
||||
public static final String LAST_FACE_TIMESTAMP = "faceTimestamp";
|
||||
|
||||
public static long getLastFaceTimestamp() {
|
||||
return SPUtil.Companion.getInstance(MyApp.getContext(), "default_sp").get(LAST_FACE_TIMESTAMP, 0L);
|
||||
init {
|
||||
spUtil = getInstance(MyApp.instance!!, "default_sp")
|
||||
}
|
||||
|
||||
public static void setLastFaceTimestamp(long timestamp) {
|
||||
SPUtil.Companion.getInstance(MyApp.getContext(), "default_sp").put(LAST_FACE_TIMESTAMP, timestamp);
|
||||
fun putString(key:String, value:String) {
|
||||
spUtil?.put(key, value)
|
||||
}
|
||||
|
||||
var lastFaceTimestamp: Long
|
||||
get() = spUtil?.get<Long?>(SpTool.LAST_FACE_TIMESTAMP, 0L) ?: 0
|
||||
set(timestamp) {
|
||||
spUtil?.put(LAST_FACE_TIMESTAMP, timestamp)
|
||||
}
|
||||
|
||||
fun savePlateData(items: List<EquipmentUserInfo>) {
|
||||
val jsonData = Gson().toJson(items)
|
||||
putString(PLATE_BOX_DATA, jsonData)
|
||||
}
|
||||
|
||||
fun getPlateData(): List<EquipmentUserInfo>? {
|
||||
val jsonData = spUtil?.get(PLATE_BOX_DATA, "")
|
||||
if (jsonData.isNullOrBlank()) {
|
||||
return null
|
||||
}
|
||||
return GsonUtils.fromJsonList(jsonData, EquipmentUserInfo::class.java)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user