绑定解绑功能调试;其它优化
This commit is contained in:
@@ -200,10 +200,10 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
private fun disableSystemUICompletely() {
|
||||
Timber.d("disableSystemUICompletely")
|
||||
// 禁用系统手势(Android 10+)
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// window.insetsController?.systemBarsBehavior =
|
||||
// WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
// }
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.insetsController?.systemBarsBehavior =
|
||||
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
|
||||
}
|
||||
|
||||
|
||||
// 全屏+隐藏导航栏(所有版本通用)
|
||||
@@ -307,7 +307,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
// }
|
||||
}
|
||||
|
||||
private fun loadEquipmentList(items:List<EquipmentUserInfo>) {
|
||||
private fun loadEquipmentList(items: List<EquipmentUserInfo>) {
|
||||
if (items.isEmpty()) return
|
||||
val unbindList = items.filter { !it.isBound() }
|
||||
if (unbindList.isEmpty()) {
|
||||
@@ -331,7 +331,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
open fun handleLoginSuccess(equipmentUserInfo: EquipmentUserInfo, isAdmin: Boolean) {
|
||||
Timber.d("handleLoginSuccess isAdmin = $isAdmin")
|
||||
equipmentUserInfo.isIntercept = false
|
||||
val cardBalance = equipmentUserInfo.cardBalance?:0.toDouble()
|
||||
val cardBalance = equipmentUserInfo.cardBalance ?: 0.toDouble()
|
||||
val balanceIsNotEnough = cardBalance <= 0.toDouble()
|
||||
if (balanceIsNotEnough && equipmentUserInfo.showBalanceNotEnoughDialog) {
|
||||
//提示余额不足弹窗
|
||||
@@ -340,15 +340,15 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
return
|
||||
}
|
||||
viewModel.resetUserInfo()
|
||||
if (equipmentUserInfo.isOtherEquipment()) {
|
||||
MainActivity.start(
|
||||
context,
|
||||
pageType = PageType.PLATE_TIP,
|
||||
equipmentUserInfo = equipmentUserInfo,
|
||||
isAdmin
|
||||
)
|
||||
return
|
||||
}
|
||||
// if (equipmentUserInfo.isOtherEquipment()) {
|
||||
// MainActivity.start(
|
||||
// context,
|
||||
// pageType = PageType.PLATE_TIP,
|
||||
// equipmentUserInfo = equipmentUserInfo,
|
||||
// isAdmin
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
if (equipmentUserInfo.equipmentBoxCode?.isNotEmpty() == true) {
|
||||
SerialApi.openPlate(
|
||||
equipmentUserInfo.equipmentBoxCode!!.toInt(),
|
||||
@@ -367,7 +367,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
})
|
||||
} else {
|
||||
if (isAdmin) {
|
||||
settingViewModel.getEquipmentList{
|
||||
settingViewModel.getEquipmentList {
|
||||
loadEquipmentList(it)
|
||||
}
|
||||
} else {
|
||||
@@ -394,31 +394,47 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
|
||||
|
||||
// private val initialDelay = 5 * 60 * 1000L
|
||||
// private val dealyMillis = 10 * 60 * 1000L
|
||||
private val initialDelay = 60 * 1000L
|
||||
private val dealyMillis = 30 * 1000L
|
||||
private val initialDelay = 1 * 60 * 1000L
|
||||
private val dealyMillis = 1 * 60 * 1000L
|
||||
private var taskPageNo = 1
|
||||
fun startFaceTask() {
|
||||
faceTaskJob =
|
||||
intervalExecutor.startIntervalTaskWithInitialDelay(initialDelay, dealyMillis) {
|
||||
val timestamp = SpTool.getLastFaceTimestamp()
|
||||
if (timestamp == 0L) {
|
||||
return@startIntervalTaskWithInitialDelay
|
||||
}
|
||||
settingViewModel.getFaceIncrementList(
|
||||
pageNo = taskPageNo,
|
||||
timestamp = timestamp
|
||||
) { list ->
|
||||
runOnUiThread {
|
||||
if (list.isEmpty()) {
|
||||
return@runOnUiThread
|
||||
}
|
||||
SpTool.setLastFaceTimestamp(System.currentTimeMillis())
|
||||
updateFaceData(list)
|
||||
}
|
||||
}
|
||||
getFaceIncrementList()
|
||||
}
|
||||
}
|
||||
|
||||
private var faceTimestamp = 0L
|
||||
|
||||
private fun getFaceIncrementList() {
|
||||
val timestamp = SpTool.getLastFaceTimestamp()
|
||||
if (timestamp == 0L) {
|
||||
return
|
||||
}
|
||||
settingViewModel.getFaceIncrementList(
|
||||
pageNo = taskPageNo,
|
||||
timestamp = timestamp
|
||||
) { list ->
|
||||
runOnUiThread {
|
||||
if (taskPageNo == 1 && list.isEmpty()) {
|
||||
//未查询到增量数据
|
||||
return@runOnUiThread
|
||||
}
|
||||
updateFaceData(list)
|
||||
if (list.size >= settingViewModel.PAGE_SIZE) {
|
||||
faceTimestamp = list.last().faceUpdateTimestamp?:0
|
||||
taskPageNo++
|
||||
getFaceIncrementList()
|
||||
return@runOnUiThread
|
||||
}
|
||||
if (list.isNotEmpty()) {
|
||||
faceTimestamp = list.last().faceUpdateTimestamp?:0
|
||||
}
|
||||
SpTool.setLastFaceTimestamp(faceTimestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val recognizeViewModel by viewModels<RecognizeViewModel>()
|
||||
private fun updateFaceData(list: List<UserFaceModel>) {
|
||||
Thread {
|
||||
|
||||
@@ -51,6 +51,8 @@ class DeviceInitActivity : BaseActivity<ActivityDeviceInitBinding>() {
|
||||
if (deviceConfig == null) {
|
||||
hideWaitingDialog()
|
||||
ToastUtils.showToast("获取设备配置数据失败")
|
||||
hideWaitingDialog()
|
||||
goLoginActivity()
|
||||
return@runOnUiThread
|
||||
}
|
||||
GlobalData.appId = deviceConfig.arcsoftAppId ?: ""
|
||||
|
||||
Reference in New Issue
Block a user