fix: 去掉面板日期 + 修复NFC全零卡号误触发

1. 面板去掉日期显示,只保留时间
2. FiseNfcController读到全零卡号(无卡贴近)时不触发回调,
   避免拿无效nfcId调API导致直接失败

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-04-28 21:17:57 +09:30
parent b274012019
commit c318dbdfa5
3 changed files with 2 additions and 15 deletions

View File

@@ -80,7 +80,8 @@ class FiseNfcController @Inject constructor() : NfcController {
content.replace("\\s+".toRegex(), "")
}
if (nfcId.isNotEmpty()) {
// 非空且非全零才算有效卡号(全零=无卡贴近)
if (nfcId.isNotEmpty() && nfcId.any { it != '0' }) {
Timber.d("NFC控制: 读到卡号 $nfcId")
// 切回主线程回调
withContext(Dispatchers.Main) {

View File

@@ -35,7 +35,6 @@ class PunchPanelView @JvmOverloads constructor(
private val overlay: View
private val panelContent: LinearLayout
private val tvPunchTime: TextView
private val tvPunchDate: TextView
private val tvNfcHint: TextView
private val btnPunchIn: TextView
private val btnPunchOut: TextView
@@ -63,7 +62,6 @@ class PunchPanelView @JvmOverloads constructor(
overlay = findViewById(R.id.overlay)
panelContent = findViewById(R.id.panelContent)
tvPunchTime = findViewById(R.id.tvPunchTime)
tvPunchDate = findViewById(R.id.tvPunchDate)
tvNfcHint = findViewById(R.id.tvNfcHint)
btnPunchIn = findViewById(R.id.btnPunchIn)
btnPunchOut = findViewById(R.id.btnPunchOut)
@@ -171,8 +169,6 @@ class PunchPanelView @JvmOverloads constructor(
/** 更新时钟显示 */
fun updateClock() {
val info = DateUtil.getDateInfo()
tvPunchTime.text = DateUtil.formatTimeShort()
tvPunchDate.text = "${info.month}${info.day}${info.week}"
}
}