feat: 考勤打卡模块(新方法论首个验证模块)

基于分析产出物开发(discovery-map考勤章节+baseline/05流程6):
- PunchFragment 3种状态(未上班/已上班/已下班)
- PunchApi 3个接口(getAttendance/onAndOffPunch/revokePunch)
- PunchStatus 数据类(字段名基于分析,非猜测)
- 上班打卡:蓝牙识别1.5s→确认弹窗→API
- 下班打卡:蓝牙识别1.5s→直接提交→低耗电模式
- 撤销打卡:确认弹窗→API→恢复
- 首页下拉手势→考勤页
- 蓝牙用模拟MAC,后续对接

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-04-28 18:34:36 +09:30
parent b7a1b2683f
commit c812b9ee1a
7 changed files with 509 additions and 4 deletions

View File

@@ -1,9 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<!-- 考勤打卡页面按原型图V3适老化设计
3种状态未上班 / 已上班 / 已下班
120dpi 换算,老年人大字体 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background">
android:background="@color/background"
android:orientation="vertical">
<!-- TODO: 打卡操作界面 -->
<!-- 固定状态栏 -->
<com.xiaoqu.watch.ui.widget.StatusBarView
android:id="@+id/statusBar"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginStart="21dp"
android:layout_marginTop="27dp"
android:layout_marginEnd="21dp" />
</FrameLayout>
<!-- 居中内容区 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingStart="21dp"
android:paddingEnd="21dp">
<!-- 考勤状态文字("未上班" / "已上班 07:02" / "已下班 17:05" -->
<TextView
android:id="@+id/tvPunchStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28sp"
android:textStyle="bold" />
<!-- 按钮区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="27dp">
<!-- 主按钮(上班打卡 / 下班打卡) -->
<TextView
android:id="@+id/btnPunch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="16dp"
android:background="@color/primary"
android:textColor="@color/text_primary"
android:textSize="26sp"
android:textStyle="bold" />
<!-- 撤销按钮(已上班+已下班时显示) -->
<TextView
android:id="@+id/btnRevoke"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="16dp"
android:background="@color/grey_button"
android:textColor="@color/error"
android:textSize="22sp"
android:textStyle="bold"
android:text="撤销打卡"
android:layout_marginTop="11dp"
android:visibility="gone" />
</LinearLayout>
<!-- 低耗电模式提示(下班后显示) -->
<LinearLayout
android:id="@+id/lowPowerHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="21dp"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="低耗电模式"
android:textColor="@color/warning"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="蓝牙扫描已停止\nNFC 已关闭"
android:textColor="@color/text_secondary"
android:textSize="16sp"
android:gravity="center"
android:lineSpacingMultiplier="1.5"
android:layout_marginTop="8dp" />
</LinearLayout>
</LinearLayout>
<!-- 底部提示(上滑返回) -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="上滑返回"
android:textColor="@color/text_secondary"
android:textSize="16sp"
android:paddingBottom="27dp" />
</LinearLayout>

View File

@@ -28,6 +28,9 @@
<!-- 首页 → 任务列表 -->
<action android:id="@+id/action_home_to_taskList"
app:destination="@id/taskListFragment" />
<!-- 首页 → 考勤打卡(下拉入口) -->
<action android:id="@+id/action_home_to_punch"
app:destination="@id/punchFragment" />
</fragment>
<!-- 设备绑定页 -->