fix: 去掉面板日期 + 修复NFC全零卡号误触发
1. 面板去掉日期显示,只保留时间 2. FiseNfcController读到全零卡号(无卡贴近)时不触发回调, 避免拿无效nfcId调API导致直接失败 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,8 @@ class FiseNfcController @Inject constructor() : NfcController {
|
|||||||
content.replace("\\s+".toRegex(), "")
|
content.replace("\\s+".toRegex(), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nfcId.isNotEmpty()) {
|
// 非空且非全零才算有效卡号(全零=无卡贴近)
|
||||||
|
if (nfcId.isNotEmpty() && nfcId.any { it != '0' }) {
|
||||||
Timber.d("NFC控制: 读到卡号 $nfcId")
|
Timber.d("NFC控制: 读到卡号 $nfcId")
|
||||||
// 切回主线程回调
|
// 切回主线程回调
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ class PunchPanelView @JvmOverloads constructor(
|
|||||||
private val overlay: View
|
private val overlay: View
|
||||||
private val panelContent: LinearLayout
|
private val panelContent: LinearLayout
|
||||||
private val tvPunchTime: TextView
|
private val tvPunchTime: TextView
|
||||||
private val tvPunchDate: TextView
|
|
||||||
private val tvNfcHint: TextView
|
private val tvNfcHint: TextView
|
||||||
private val btnPunchIn: TextView
|
private val btnPunchIn: TextView
|
||||||
private val btnPunchOut: TextView
|
private val btnPunchOut: TextView
|
||||||
@@ -63,7 +62,6 @@ class PunchPanelView @JvmOverloads constructor(
|
|||||||
overlay = findViewById(R.id.overlay)
|
overlay = findViewById(R.id.overlay)
|
||||||
panelContent = findViewById(R.id.panelContent)
|
panelContent = findViewById(R.id.panelContent)
|
||||||
tvPunchTime = findViewById(R.id.tvPunchTime)
|
tvPunchTime = findViewById(R.id.tvPunchTime)
|
||||||
tvPunchDate = findViewById(R.id.tvPunchDate)
|
|
||||||
tvNfcHint = findViewById(R.id.tvNfcHint)
|
tvNfcHint = findViewById(R.id.tvNfcHint)
|
||||||
btnPunchIn = findViewById(R.id.btnPunchIn)
|
btnPunchIn = findViewById(R.id.btnPunchIn)
|
||||||
btnPunchOut = findViewById(R.id.btnPunchOut)
|
btnPunchOut = findViewById(R.id.btnPunchOut)
|
||||||
@@ -171,8 +169,6 @@ class PunchPanelView @JvmOverloads constructor(
|
|||||||
|
|
||||||
/** 更新时钟显示 */
|
/** 更新时钟显示 */
|
||||||
fun updateClock() {
|
fun updateClock() {
|
||||||
val info = DateUtil.getDateInfo()
|
|
||||||
tvPunchTime.text = DateUtil.formatTimeShort()
|
tvPunchTime.text = DateUtil.formatTimeShort()
|
||||||
tvPunchDate.text = "${info.month}月${info.day}日 ${info.week}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,16 +37,6 @@
|
|||||||
android:textColor="@color/text_primary"
|
android:textColor="@color/text_primary"
|
||||||
android:textSize="48sp" />
|
android:textSize="48sp" />
|
||||||
|
|
||||||
<!-- 日期显示 -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvPunchDate"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:text="1月1日 星期一"
|
|
||||||
android:textColor="@color/text_secondary"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
|
|
||||||
<!-- NFC 扫描提示(默认隐藏) -->
|
<!-- NFC 扫描提示(默认隐藏) -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvNfcHint"
|
android:id="@+id/tvNfcHint"
|
||||||
|
|||||||
Reference in New Issue
Block a user