Files
xqwatch/app/src/main/res/layout/activity_main.xml
T
dongliangandClaude Opus 4.6 6e8b210f8e feat(ota): OTA APK 下载更新模块
REQ-20260430-0041

新增 UpdateManager:
- POST newAppVersion/queryWatch 检查版本(5分钟最小间隔)
- OkHttp 下载 APK(进度回调,独立超时配置)
- FileProvider + Intent ACTION_VIEW 触发系统安装
- 非 .apk 链接自动跳过

新增 UpdateDialogView:
- 全屏覆盖弹窗,三种状态(发现新版本/下载中/下载失败)
- 进度条支持百分比和未知大小两种模式

配置变更:
- AndroidManifest: REQUEST_INSTALL_PACKAGES + FileProvider
- CommonApi.checkVersion: GET→POST,传 version 参数

集成点:
- HomeFragment.onResume → MainActivity.checkForUpdate()
- MainActivity 管理弹窗交互和下载流程
- 更新时停止蓝牙扫描 + 保持屏幕常亮

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 21:20:06 +09:30

44 lines
1.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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: 通知横幅(所有 Fragment 之上,MQTT 新任务时显示) -->
<com.xiaoqu.watch.ui.widget.NotificationBannerView
android:id="@+id/notificationBanner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top" />
<!-- Layer 3: 全局弹窗层(QuTipDialog / QuConfirmDialog 动态添加,默认隐藏) -->
<FrameLayout
android:id="@+id/dialog_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<!-- Layer 4: OTA 更新弹窗(最顶层,全屏覆盖,默认隐藏) -->
<com.xiaoqu.watch.ui.widget.UpdateDialogView
android:id="@+id/updateDialog"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</FrameLayout>