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>
37 lines
1.5 KiB
XML
37 lines
1.5 KiB
XML
<?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>
|