feat: 首页与应用壳模块
新增: - StatusBarView 自定义状态栏(圆点+信号条+电池壳,按原型图V3) - ViewPager2 左右滑动(设置页/主页,默认主页) - 主页:时钟+日期+快捷区3卡片(对接statisticsNew API) - 设置页:圆形头像+用户信息+设备信息+调试模式 - TaskApi 接口(统计+考勤) - HomePagerAdapter(View方式,避免Fragment嵌套) - 页面指示器+快捷区卡片背景drawable 修改: - HomeFragment 重写为ViewPager2容器 - NetworkModule 添加TaskApi提供者 - styles.xml 添加ConfigRow/Label/Value样式 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,67 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 首页布局:NavBar + 硬件验证 demo -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<!-- 首页容器:ViewPager2 左右滑动(设置页 / 主页) -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
android:orientation="vertical">
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- 顶部导航栏 -->
|
||||
<include layout="@layout/layout_nav_bar" />
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<ScrollView
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/safe_area_left"
|
||||
android:paddingEnd="@dimen/safe_area_right"
|
||||
android:paddingBottom="@dimen/safe_area_bottom">
|
||||
|
||||
<!-- 系统状态信息 -->
|
||||
<TextView
|
||||
android:id="@+id/tvStatus"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="@dimen/text_small"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 屏幕控制测试 -->
|
||||
<TextView
|
||||
android:id="@+id/btnScreenOff"
|
||||
style="@style/ActionButton.Warning"
|
||||
android:text="熄屏测试(3秒后亮屏)"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 振动测试 -->
|
||||
<TextView
|
||||
android:id="@+id/btnVibrate"
|
||||
style="@style/ActionButton.Primary"
|
||||
android:text="振动测试"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- NFC 测试 -->
|
||||
<TextView
|
||||
android:id="@+id/btnNfcScan"
|
||||
style="@style/ActionButton.Success"
|
||||
android:text="NFC 读卡测试"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 弹窗测试 -->
|
||||
<TextView
|
||||
android:id="@+id/btnShowTip"
|
||||
style="@style/ActionButton.Grey"
|
||||
android:text="提示弹窗测试"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
141
app/src/main/res/layout/page_config.xml
Normal file
141
app/src/main/res/layout/page_config.xml
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 设置页(ViewPager2 Page 0):状态栏 + 用户信息 + 设备信息 + 手表信息入口 -->
|
||||
<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:orientation="vertical"
|
||||
android:paddingStart="@dimen/safe_area_left"
|
||||
android:paddingTop="@dimen/safe_area_top"
|
||||
android:paddingEnd="@dimen/safe_area_right"
|
||||
android:paddingBottom="@dimen/safe_area_bottom">
|
||||
|
||||
<!-- 自定义状态栏 -->
|
||||
<com.xiaoqu.watch.ui.widget.StatusBarView
|
||||
android:id="@+id/statusBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="18dp" />
|
||||
|
||||
<!-- 可滚动内容区 -->
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 用户信息区域(居中,可点击触发调试模式) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/userBlock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<!-- 圆形头像(渐变背景 + 首字母) -->
|
||||
<FrameLayout
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginBottom="6dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAvatarLetter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!-- 姓名 -->
|
||||
<TextView
|
||||
android:id="@+id/tvUserName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- 手机号(脱敏) -->
|
||||
<TextView
|
||||
android:id="@+id/tvUserPhone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="11sp"
|
||||
android:layout_marginTop="2dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 设备信息列表 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 设备型号 -->
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="设备型号" />
|
||||
<TextView android:id="@+id/tvModel" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 系统版本 -->
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="系统版本" />
|
||||
<TextView android:id="@+id/tvOsVersion" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- IMEI -->
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="IMEI" />
|
||||
<TextView android:id="@+id/tvImei" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- App 版本 -->
|
||||
<LinearLayout style="@style/ConfigRow">
|
||||
<TextView style="@style/ConfigLabel" android:text="App 版本" />
|
||||
<TextView android:id="@+id/tvAppVersion" style="@style/ConfigValue" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<!-- 页面指示器 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/indConfig0"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/indicator_dot_active" />
|
||||
|
||||
<View
|
||||
android:id="@+id/indConfig1"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="5dp"
|
||||
android:background="@drawable/indicator_dot_inactive" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
176
app/src/main/res/layout/page_main.xml
Normal file
176
app/src/main/res/layout/page_main.xml
Normal file
@@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 主页(ViewPager2 Page 1):状态栏 + 时钟 + 日期 + 快捷区 + 指示器
|
||||
用户群体为老年人,字体尽可能大 -->
|
||||
<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:orientation="vertical"
|
||||
android:paddingStart="@dimen/safe_area_left"
|
||||
android:paddingTop="@dimen/safe_area_top"
|
||||
android:paddingEnd="@dimen/safe_area_right"
|
||||
android:paddingBottom="@dimen/safe_area_bottom">
|
||||
|
||||
<!-- 自定义状态栏(蓝牙圆点 + 信号条 + 电池壳) -->
|
||||
<com.xiaoqu.watch.ui.widget.StatusBarView
|
||||
android:id="@+id/statusBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginBottom="2dp" />
|
||||
|
||||
<!-- 时钟区域(居中撑满) -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 时钟 HH:mm -->
|
||||
<TextView
|
||||
android:id="@+id/tvClock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="14:30"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="48sp"
|
||||
android:textStyle="bold"
|
||||
android:letterSpacing="0.05" />
|
||||
|
||||
<!-- 日期 + 星期 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4月23日 周三"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="16sp"
|
||||
android:layout_marginTop="6dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 快捷区:3 个彩色卡片 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 接单池(蓝色) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/cardPool"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:background="@drawable/bg_quick_blue"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPoolNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="接单池"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="4dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 待打卡(橙色) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/cardPunch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="2dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:background="@drawable/bg_quick_orange"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPunchNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="@color/warning"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="待打卡"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="4dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 待完成(绿色) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/cardComplete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="4dp"
|
||||
android:background="@drawable/bg_quick_green"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCompleteNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="@color/success"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="待完成"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="4dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 页面指示器 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/indMain0"
|
||||
android:layout_width="5dp"
|
||||
android:layout_height="5dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/indicator_dot_inactive" />
|
||||
|
||||
<View
|
||||
android:id="@+id/indMain1"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="5dp"
|
||||
android:background="@drawable/indicator_dot_active" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user