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>
227 lines
7.9 KiB
XML
227 lines
7.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- 主页(ViewPager2 Page 1)
|
||
屏幕 240×284px, 密度 120dpi, 1dp=0.75px, 换算: px/0.75=dp
|
||
原型图 safe area: top20 left16 right16 bottom20 → dp: 27 21 21 27 -->
|
||
<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"
|
||
android:paddingBottom="27dp">
|
||
|
||
<!-- 时钟区域(flex:1 撑满中间) -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="0dp"
|
||
android:layout_weight="1"
|
||
android:gravity="center"
|
||
android:orientation="vertical">
|
||
|
||
<!-- 时钟 52px → 69sp -->
|
||
<TextView
|
||
android:id="@+id/tvClock"
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="14:30"
|
||
android:textColor="@color/text_primary"
|
||
android:textSize="69sp"
|
||
android:fontFamily="sans-serif-medium"
|
||
android:letterSpacing="0.02"
|
||
android:includeFontPadding="false" />
|
||
|
||
<!-- 日期 15px → 20sp -->
|
||
<TextView
|
||
android:id="@+id/tvDate"
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="4月23日 周三"
|
||
android:textColor="@color/text_primary"
|
||
android:textSize="26sp"
|
||
android:fontFamily="sans-serif-medium"
|
||
android:layout_marginTop="11dp" />
|
||
|
||
</LinearLayout>
|
||
|
||
<!-- 快捷区 gap:6px→8dp -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:orientation="horizontal">
|
||
|
||
<!-- 接单池(蓝色)+ 红点角标 -->
|
||
<FrameLayout
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginEnd="5dp">
|
||
|
||
<LinearLayout
|
||
android:id="@+id/cardPool"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:background="@drawable/bg_quick_blue"
|
||
android:gravity="center"
|
||
android:orientation="vertical"
|
||
android:paddingTop="19dp"
|
||
android:paddingBottom="16dp">
|
||
|
||
<!-- 数字 32px → 43sp -->
|
||
<TextView
|
||
android:id="@+id/tvPoolNum"
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="0"
|
||
android:textColor="@color/primary"
|
||
android:textSize="43sp"
|
||
android:textStyle="bold"
|
||
android:includeFontPadding="false" />
|
||
|
||
<!-- 标签 12px → 16sp -->
|
||
<TextView
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="接单池"
|
||
android:textColor="@color/text_primary"
|
||
android:textSize="20sp"
|
||
android:textStyle="bold"
|
||
android:layout_marginTop="5dp" />
|
||
</LinearLayout>
|
||
|
||
<!-- 红点角标 -->
|
||
<View
|
||
android:id="@+id/dotPool"
|
||
android:layout_width="10dp"
|
||
android:layout_height="10dp"
|
||
android:layout_gravity="top|end"
|
||
android:layout_marginTop="4dp"
|
||
android:layout_marginEnd="4dp"
|
||
android:background="@drawable/bg_red_dot"
|
||
android:visibility="gone" />
|
||
|
||
</FrameLayout>
|
||
|
||
<!-- 待打卡(橙色)+ 红点角标 -->
|
||
<FrameLayout
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="3dp"
|
||
android:layout_marginEnd="3dp">
|
||
|
||
<LinearLayout
|
||
android:id="@+id/cardPunch"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:background="@drawable/bg_quick_orange"
|
||
android:gravity="center"
|
||
android:orientation="vertical"
|
||
android:paddingTop="19dp"
|
||
android:paddingBottom="16dp">
|
||
|
||
<TextView
|
||
android:id="@+id/tvPunchNum"
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="0"
|
||
android:textColor="@color/warning"
|
||
android:textSize="43sp"
|
||
android:textStyle="bold"
|
||
android:includeFontPadding="false" />
|
||
|
||
<TextView
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="待打卡"
|
||
android:textColor="@color/text_primary"
|
||
android:textSize="20sp"
|
||
android:textStyle="bold"
|
||
android:layout_marginTop="5dp" />
|
||
</LinearLayout>
|
||
|
||
<View
|
||
android:id="@+id/dotPunch"
|
||
android:layout_width="10dp"
|
||
android:layout_height="10dp"
|
||
android:layout_gravity="top|end"
|
||
android:layout_marginTop="4dp"
|
||
android:layout_marginEnd="4dp"
|
||
android:background="@drawable/bg_red_dot"
|
||
android:visibility="gone" />
|
||
|
||
</FrameLayout>
|
||
|
||
<!-- 待完成(绿色)+ 红点角标 -->
|
||
<FrameLayout
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:layout_weight="1"
|
||
android:layout_marginStart="5dp">
|
||
|
||
<LinearLayout
|
||
android:id="@+id/cardComplete"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:background="@drawable/bg_quick_green"
|
||
android:gravity="center"
|
||
android:orientation="vertical"
|
||
android:paddingTop="19dp"
|
||
android:paddingBottom="16dp">
|
||
|
||
<TextView
|
||
android:id="@+id/tvCompleteNum"
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="0"
|
||
android:textColor="@color/success"
|
||
android:textSize="43sp"
|
||
android:textStyle="bold"
|
||
android:includeFontPadding="false" />
|
||
|
||
<TextView
|
||
android:layout_width="wrap_content"
|
||
android:layout_height="wrap_content"
|
||
android:text="待完成"
|
||
android:textColor="@color/text_primary"
|
||
android:textSize="20sp"
|
||
android:textStyle="bold"
|
||
android:layout_marginTop="5dp" />
|
||
</LinearLayout>
|
||
|
||
<View
|
||
android:id="@+id/dotComplete"
|
||
android:layout_width="10dp"
|
||
android:layout_height="10dp"
|
||
android:layout_gravity="top|end"
|
||
android:layout_marginTop="4dp"
|
||
android:layout_marginEnd="4dp"
|
||
android:background="@drawable/bg_red_dot"
|
||
android:visibility="gone" />
|
||
|
||
</FrameLayout>
|
||
|
||
</LinearLayout>
|
||
|
||
<!-- 页面指示器 margin-top:10px→13dp -->
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:gravity="center"
|
||
android:paddingTop="13dp">
|
||
|
||
<View
|
||
android:id="@+id/indMain0"
|
||
android:layout_width="7dp"
|
||
android:layout_height="7dp"
|
||
android:layout_marginEnd="7dp"
|
||
android:background="@drawable/indicator_dot_inactive" />
|
||
|
||
<View
|
||
android:id="@+id/indMain1"
|
||
android:layout_width="19dp"
|
||
android:layout_height="7dp"
|
||
android:background="@drawable/indicator_dot_active" />
|
||
|
||
</LinearLayout>
|
||
|
||
</LinearLayout>
|