feat: 设备绑定与配对模块
新增: - SplashFragment 启动分发(初始化+绑定检查+导航到Home或Bind) - BindFragment 二维码配对页面(ZXing生成QR码+MQTT绑定监听) - WatchBindInfo 绑定信息数据类 修改: - nav_main.xml startDestination改为SplashFragment,添加导航action - HomeFragment 移除初始化逻辑到Splash,添加MQTT解绑处理 - CommonApi getWatchByImei返回类型改为WatchBindInfo Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<!-- BindFragment:二维码配对页面(全屏,无 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:background="@color/background"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/safe_area_left">
|
||||
|
||||
<!-- TODO: 二维码 + 设备信息 -->
|
||||
<!-- 二维码图片 -->
|
||||
<ImageView
|
||||
android:id="@+id/ivQrCode"
|
||||
android:layout_width="160dp"
|
||||
android:layout_height="160dp"
|
||||
android:layout_marginBottom="@dimen/spacing_lg"
|
||||
android:contentDescription="配对二维码" />
|
||||
|
||||
</FrameLayout>
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="扫码绑定手表"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="@dimen/text_title"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="@dimen/spacing_md" />
|
||||
|
||||
<!-- 说明文字 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1. 下载小趣智品APP"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="@dimen/text_caption"
|
||||
android:layout_marginBottom="@dimen/spacing_xs" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2. 在APP中扫此码添加手表"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="@dimen/text_caption" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
6
app/src/main/res/layout/fragment_splash.xml
Normal file
6
app/src/main/res/layout/fragment_splash.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- SplashFragment:启动分发页,纯逻辑无 UI(黑色背景) -->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/background" />
|
||||
@@ -2,19 +2,56 @@
|
||||
<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">
|
||||
app:startDestination="@id/splashFragment">
|
||||
|
||||
<!-- 启动分发页(检查绑定状态 → Home 或 Bind) -->
|
||||
<fragment
|
||||
android:id="@+id/splashFragment"
|
||||
android:name="com.xiaoqu.watch.ui.common.SplashFragment"
|
||||
android:label="启动">
|
||||
|
||||
<!-- splash → home(已绑定) -->
|
||||
<action
|
||||
android:id="@+id/action_splash_to_home"
|
||||
app:destination="@id/homeFragment"
|
||||
app:popUpTo="@id/splashFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
|
||||
<!-- splash → bind(未绑定) -->
|
||||
<action
|
||||
android:id="@+id/action_splash_to_bind"
|
||||
app:destination="@id/bindFragment"
|
||||
app:popUpTo="@id/splashFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
<!-- 首页(含 ViewPager2 左右滑动:设置页 / 主页) -->
|
||||
<fragment
|
||||
android:id="@+id/homeFragment"
|
||||
android:name="com.xiaoqu.watch.ui.home.HomeFragment"
|
||||
android:label="首页" />
|
||||
android:label="首页">
|
||||
|
||||
<!-- home → bind(解绑后) -->
|
||||
<action
|
||||
android:id="@+id/action_home_to_bind"
|
||||
app:destination="@id/bindFragment"
|
||||
app:popUpTo="@id/homeFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
<!-- 设备绑定页(全屏二维码) -->
|
||||
<fragment
|
||||
android:id="@+id/bindFragment"
|
||||
android:name="com.xiaoqu.watch.ui.bind.BindFragment"
|
||||
android:label="设备绑定" />
|
||||
android:label="设备绑定">
|
||||
|
||||
<!-- bind → home(绑定成功后) -->
|
||||
<action
|
||||
android:id="@+id/action_bind_to_home"
|
||||
app:destination="@id/homeFragment"
|
||||
app:popUpTo="@id/bindFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
<!-- 任务列表 -->
|
||||
<fragment
|
||||
|
||||
Reference in New Issue
Block a user