feat: 小趣手表APP Android原生重构 - 基础框架搭建
已完成的模块: 1. 项目脚手架 - Gradle配置、28个包目录、核心基类 2. 权限管理 - 确认定制ROM已预授权所有权限 3. 工具类 - DateUtil/DeviceUtil/NetworkUtil/Md5Util 4. 设备信息 - DevicePrefs/UserPrefs (SharedPreferences) 5. 网络层 - OkHttp+Retrofit+MD5签名拦截器+解绑拦截器 6. 基础UI组件 - NavBarView/QuTipDialog/QuConfirmDialog/ActionButton/iconfont Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
BIN
app/src/main/res/font/iconfont.ttf
Normal file
29
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- MainActivity 布局:NavBar 已移入各 Fragment 自行管理
|
||||
只保留 NavHostFragment(主内容)和 dialog_container(全局弹窗层) -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background"
|
||||
tools:context=".app.MainActivity">
|
||||
|
||||
<!-- Layer 1: 主内容区(NavHostFragment) -->
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/nav_host_fragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/nav_main" />
|
||||
|
||||
<!-- Layer 2: 全局弹窗层(QuTipDialog / QuConfirmDialog 动态添加,默认隐藏) -->
|
||||
<FrameLayout
|
||||
android:id="@+id/dialog_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
||||
57
app/src/main/res/layout/dialog_confirm.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- QuConfirmDialog 布局:确认弹窗
|
||||
结构:半透明遮罩 + 居中内容区 + 底部取消(×)/确认(✓)图标按钮 -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/confirmOverlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/overlay">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/spacing_lg">
|
||||
|
||||
<!-- 内容区域(由调用方动态设置) -->
|
||||
<FrameLayout
|
||||
android:id="@+id/confirmContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/spacing_xl" />
|
||||
|
||||
<!-- 底部按钮组(取消 × / 确认 ✓) -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 取消按钮(×) -->
|
||||
<TextView
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center"
|
||||
android:text="\ue623"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="36sp"
|
||||
android:layout_marginEnd="@dimen/spacing_xl" />
|
||||
|
||||
<!-- 确认按钮(✓) -->
|
||||
<TextView
|
||||
android:id="@+id/btnConfirm"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center"
|
||||
android:text="\ue600"
|
||||
android:textColor="@color/success"
|
||||
android:textSize="36sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
57
app/src/main/res/layout/dialog_tip.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- QuTipDialog 布局:提示弹窗(成功/警告/错误)
|
||||
结构:全屏遮罩 + 居中内容(图标 + 标题 + 描述 + 倒计时返回按钮) -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/spacing_lg">
|
||||
|
||||
<!-- 状态图标(成功✓ / 警告! / 错误×) -->
|
||||
<TextView
|
||||
android:id="@+id/tipIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="48sp"
|
||||
android:layout_marginBottom="@dimen/spacing_md" />
|
||||
|
||||
<!-- 标题文字 -->
|
||||
<TextView
|
||||
android:id="@+id/tipTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="@dimen/text_title"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 描述文字(可选) -->
|
||||
<TextView
|
||||
android:id="@+id/tipDesc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="@dimen/text_caption"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="@dimen/spacing_lg" />
|
||||
|
||||
<!-- 倒计时返回按钮(显示"返回 3s") -->
|
||||
<TextView
|
||||
android:id="@+id/tipBackBtn"
|
||||
android:layout_width="@dimen/touch_min_size"
|
||||
android:layout_height="@dimen/touch_min_size"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="@dimen/text_caption"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
9
app/src/main/res/layout/fragment_bind.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- TODO: 二维码 + 设备信息 -->
|
||||
|
||||
</FrameLayout>
|
||||
94
app/src/main/res/layout/fragment_home.xml
Normal file
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 首页布局:NavBar + 内容区 -->
|
||||
<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">
|
||||
|
||||
<!-- 顶部导航栏(首页模式:状态图标 + 时间 + 电量) -->
|
||||
<include layout="@layout/layout_nav_bar" />
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<ScrollView
|
||||
android:layout_width="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">
|
||||
|
||||
<!-- demo 信息展示 -->
|
||||
<TextView
|
||||
android:id="@+id/tvDemoInfo"
|
||||
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_md" />
|
||||
|
||||
<!-- 按钮 demo:触发 QuTipDialog -->
|
||||
<TextView
|
||||
android:id="@+id/btnShowTip"
|
||||
style="@style/ActionButton.Primary"
|
||||
android:text="显示提示弹窗"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 按钮 demo:触发 QuConfirmDialog -->
|
||||
<TextView
|
||||
android:id="@+id/btnShowConfirm"
|
||||
style="@style/ActionButton.Success"
|
||||
android:text="显示确认弹窗"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 按钮 demo:其他样式展示 -->
|
||||
<TextView
|
||||
android:id="@+id/btnDanger"
|
||||
style="@style/ActionButton.Danger"
|
||||
android:text="危险按钮"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnWarning"
|
||||
style="@style/ActionButton.Warning"
|
||||
android:text="警告按钮"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnGrey"
|
||||
style="@style/ActionButton.Grey"
|
||||
android:text="灰色按钮"
|
||||
android:layout_marginBottom="@dimen/spacing_sm" />
|
||||
|
||||
<!-- 半宽按钮并排 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/ActionButton.Grey"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="取消"
|
||||
android:layout_marginEnd="@dimen/spacing_sm" />
|
||||
|
||||
<TextView
|
||||
style="@style/ActionButton.Primary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:text="确定" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
9
app/src/main/res/layout/fragment_info.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- TODO: 设备信息展示 -->
|
||||
|
||||
</FrameLayout>
|
||||
9
app/src/main/res/layout/fragment_punch.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- TODO: 打卡操作界面 -->
|
||||
|
||||
</FrameLayout>
|
||||
9
app/src/main/res/layout/fragment_task_detail.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- TODO: 任务详情 + 操作按钮 -->
|
||||
|
||||
</FrameLayout>
|
||||
9
app/src/main/res/layout/fragment_task_list.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background">
|
||||
|
||||
<!-- TODO: RecyclerView 任务列表 -->
|
||||
|
||||
</FrameLayout>
|
||||
108
app/src/main/res/layout/layout_nav_bar.xml
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- NavBarView:顶部导航栏,每个 Fragment 通过 <include> 引入
|
||||
左/中/右三栏布局:
|
||||
- 首页:左=状态图标(蓝牙/4G/NFC),中=时间,右=电量
|
||||
- 子页面:左=返回按钮,中=标题,右=电量 -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/navBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_bar_height"
|
||||
android:background="@color/background"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/safe_area_left"
|
||||
android:paddingEnd="@dimen/safe_area_right">
|
||||
|
||||
<!-- 左侧区域(状态图标 或 返回按钮) -->
|
||||
<FrameLayout
|
||||
android:id="@+id/navLeft"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<!-- 返回按钮(子页面用,默认隐藏) -->
|
||||
<TextView
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="@dimen/touch_min_size"
|
||||
android:layout_height="@dimen/touch_min_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:text="\ue6bd"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="18sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<!-- 状态图标组(首页用,默认显示) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/statusIcons"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 蓝牙状态 -->
|
||||
<TextView
|
||||
android:id="@+id/iconBluetooth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="\ue6da"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="14sp"
|
||||
android:paddingEnd="6dp" />
|
||||
|
||||
<!-- 4G 状态 -->
|
||||
<TextView
|
||||
android:id="@+id/icon4G"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="\ue6dc"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="14sp"
|
||||
android:paddingEnd="6dp" />
|
||||
|
||||
<!-- NFC 状态 -->
|
||||
<TextView
|
||||
android:id="@+id/iconNfc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="\ue6d8"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!-- 中间区域(时间 或 标题) -->
|
||||
<TextView
|
||||
android:id="@+id/navTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="@dimen/text_body" />
|
||||
|
||||
<!-- 右侧区域(电量图标) -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|end"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 电量图标 -->
|
||||
<TextView
|
||||
android:id="@+id/iconBattery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="\ue6ce"
|
||||
android:textColor="@color/success"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
6
app/src/main/res/mipmap-anydpi/ic_launcher.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
6
app/src/main/res/mipmap-anydpi/ic_launcher_round.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
43
app/src/main/res/navigation/nav_main.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/nav_main"
|
||||
app:startDestination="@id/homeFragment">
|
||||
|
||||
<!-- 首页(含 ViewPager2 左右滑动:设置页 / 主页) -->
|
||||
<fragment
|
||||
android:id="@+id/homeFragment"
|
||||
android:name="com.xiaoqu.watch.ui.home.HomeFragment"
|
||||
android:label="首页" />
|
||||
|
||||
<!-- 设备绑定页(全屏二维码) -->
|
||||
<fragment
|
||||
android:id="@+id/bindFragment"
|
||||
android:name="com.xiaoqu.watch.ui.bind.BindFragment"
|
||||
android:label="设备绑定" />
|
||||
|
||||
<!-- 任务列表 -->
|
||||
<fragment
|
||||
android:id="@+id/taskListFragment"
|
||||
android:name="com.xiaoqu.watch.ui.task.TaskListFragment"
|
||||
android:label="任务列表" />
|
||||
|
||||
<!-- 任务详情 -->
|
||||
<fragment
|
||||
android:id="@+id/taskDetailFragment"
|
||||
android:name="com.xiaoqu.watch.ui.task.TaskDetailFragment"
|
||||
android:label="任务详情" />
|
||||
|
||||
<!-- 打卡页 -->
|
||||
<fragment
|
||||
android:id="@+id/punchFragment"
|
||||
android:name="com.xiaoqu.watch.ui.punch.PunchFragment"
|
||||
android:label="打卡" />
|
||||
|
||||
<!-- 设备信息 -->
|
||||
<fragment
|
||||
android:id="@+id/infoFragment"
|
||||
android:name="com.xiaoqu.watch.ui.info.InfoFragment"
|
||||
android:label="设备信息" />
|
||||
|
||||
</navigation>
|
||||
7
app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Base.Theme.XqWatch" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your dark theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
|
||||
</style>
|
||||
</resources>
|
||||
36
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<!-- 全局背景 -->
|
||||
<color name="background">#FF000000</color>
|
||||
|
||||
<!-- 主题色 -->
|
||||
<color name="primary">#FF007AFF</color>
|
||||
<color name="action_primary">#FF339AFB</color>
|
||||
|
||||
<!-- 状态色 -->
|
||||
<color name="success">#FF1CC46B</color>
|
||||
<color name="warning">#FFEB9A26</color>
|
||||
<color name="error">#FFDA5050</color>
|
||||
|
||||
<!-- 按钮色 -->
|
||||
<color name="grey_button">#FF666666</color>
|
||||
|
||||
<!-- 文字色 -->
|
||||
<color name="text_primary">#FFFFFFFF</color>
|
||||
<color name="text_secondary">#FF999999</color>
|
||||
<color name="text_placeholder">#FF808080</color>
|
||||
<color name="text_disabled">#FFC0C0C0</color>
|
||||
|
||||
<!-- 界面元素 -->
|
||||
<color name="overlay">#66000000</color>
|
||||
<color name="border">#FFC8C7CC</color>
|
||||
<color name="card_background">#FF1A1A1A</color>
|
||||
<color name="pressed">#FFF1F1F1</color>
|
||||
|
||||
<!-- 状态图标 -->
|
||||
<color name="charge_green">#FF00FF00</color>
|
||||
<color name="disconnect_red">#FF8B0000</color>
|
||||
</resources>
|
||||
44
app/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- SafeArea 内边距(圆角屏防裁切) -->
|
||||
<dimen name="safe_area_left">12dp</dimen>
|
||||
<dimen name="safe_area_top">16dp</dimen>
|
||||
<dimen name="safe_area_right">12dp</dimen>
|
||||
<dimen name="safe_area_bottom">16dp</dimen>
|
||||
|
||||
<!-- NavBar -->
|
||||
<dimen name="nav_bar_height">60dp</dimen>
|
||||
|
||||
<!-- 字体大小 -->
|
||||
<dimen name="text_title">18sp</dimen>
|
||||
<dimen name="text_body">15sp</dimen>
|
||||
<dimen name="text_caption">13sp</dimen>
|
||||
<dimen name="text_small">11sp</dimen>
|
||||
<dimen name="text_button">15sp</dimen>
|
||||
<dimen name="text_button_small">13sp</dimen>
|
||||
|
||||
<!-- 间距 -->
|
||||
<dimen name="spacing_xs">4dp</dimen>
|
||||
<dimen name="spacing_sm">8dp</dimen>
|
||||
<dimen name="spacing_md">12dp</dimen>
|
||||
<dimen name="spacing_lg">16dp</dimen>
|
||||
<dimen name="spacing_xl">24dp</dimen>
|
||||
|
||||
<!-- 圆角 -->
|
||||
<dimen name="corner_radius_sm">4dp</dimen>
|
||||
<dimen name="corner_radius_md">8dp</dimen>
|
||||
<dimen name="corner_radius_lg">16dp</dimen>
|
||||
<dimen name="corner_radius_button">8dp</dimen>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<dimen name="button_height">40dp</dimen>
|
||||
<dimen name="button_half_width">120dp</dimen>
|
||||
|
||||
<!-- 触摸区域最小尺寸 -->
|
||||
<dimen name="touch_min_size">40dp</dimen>
|
||||
|
||||
<!-- 图标 -->
|
||||
<dimen name="icon_sm">16dp</dimen>
|
||||
<dimen name="icon_md">24dp</dimen>
|
||||
<dimen name="icon_lg">32dp</dimen>
|
||||
</resources>
|
||||
3
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">XqWatch</string>
|
||||
</resources>
|
||||
42
app/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- ===== ActionButton 基础样式 ===== -->
|
||||
<style name="ActionButton">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">@dimen/button_height</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
<item name="android:textSize">@dimen/text_button</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<!-- 主色按钮(默认) -->
|
||||
<style name="ActionButton.Primary">
|
||||
<item name="android:background">@color/action_primary</item>
|
||||
</style>
|
||||
|
||||
<!-- 成功按钮(确认/完成) -->
|
||||
<style name="ActionButton.Success">
|
||||
<item name="android:background">@color/success</item>
|
||||
</style>
|
||||
|
||||
<!-- 危险按钮(取消/撤销) -->
|
||||
<style name="ActionButton.Danger">
|
||||
<item name="android:background">@color/error</item>
|
||||
</style>
|
||||
|
||||
<!-- 警告按钮(抢单) -->
|
||||
<style name="ActionButton.Warning">
|
||||
<item name="android:background">@color/warning</item>
|
||||
</style>
|
||||
|
||||
<!-- 灰色按钮(返回/次要操作) -->
|
||||
<style name="ActionButton.Grey">
|
||||
<item name="android:background">@color/grey_button</item>
|
||||
</style>
|
||||
|
||||
<!-- 半宽按钮(两个并排时使用) -->
|
||||
<style name="ActionButton.Half">
|
||||
<item name="android:layout_width">@dimen/button_half_width</item>
|
||||
</style>
|
||||
</resources>
|
||||
29
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- 应用主题:黑底全屏、无 ActionBar、无窗口动画 -->
|
||||
<style name="Base.Theme.XqWatch" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- 背景色 -->
|
||||
<item name="android:windowBackground">@color/background</item>
|
||||
<item name="android:colorBackground">@color/background</item>
|
||||
|
||||
<!-- 主题色 -->
|
||||
<item name="colorPrimary">@color/primary</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
|
||||
<!-- 全屏(隐藏状态栏/导航栏) -->
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
|
||||
<!-- 禁用窗口动画(手表性能优先) -->
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
|
||||
<!-- 文字颜色 -->
|
||||
<item name="android:textColorPrimary">@color/text_primary</item>
|
||||
<item name="android:textColorSecondary">@color/text_secondary</item>
|
||||
<item name="android:textColorHint">@color/text_placeholder</item>
|
||||
|
||||
<!-- 固定竖屏 -->
|
||||
<item name="android:screenOrientation">portrait</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.XqWatch" parent="Base.Theme.XqWatch" />
|
||||
</resources>
|
||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older than API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
</full-backup-content>
|
||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||