Files
xqwatch/app/src/main/res/layout/activity_main.xml
dongliang dd3905b743 feat: 消息通知模块(横幅+红点+跳转)
MQTT type=1 新任务推送 → 震动+亮屏+顶部蓝色横幅+卡片红点。

新增:
- NotificationManager: 去抖1s+内存存储taskIds+统计对比红点
- NotificationBannerView: Activity层横幅(滑入/10s倒计时/点击)
- AppEvent.NewTaskArrived: 携带taskIds和count

集成:
- MainActivity: 监听MQTT type=1→NotificationManager→横幅
- HomeFragment: 监听NewTaskArrived→刷新统计+对比红点+横幅点击跳转
- page_main.xml: 3个卡片各加红点角标(FrameLayout包裹)
- nav_main.xml: 新增action_home_to_taskDetail

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

37 lines
1.5 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" />
</FrameLayout>