2026-11-28 01:07:24 +08:00
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
|
<!--
|
|
|
|
|
|
常驻计时通知的自定义布局(RemoteViews)。
|
|
|
|
|
|
|
|
|
|
|
|
为什么不用系统模板:模板第一行固定是应用名,无法替换成任务名;
|
|
|
|
|
|
这里自己排两行 —— 第一行任务名,第二行系统 Chronometer 走时。
|
|
|
|
|
|
Chronometer 由 SystemUI 渲染,锁屏与息屏下照常走字,不受应用进程被限流的影响。
|
|
|
|
|
|
|
|
|
|
|
|
注意:RemoteViews 只支持有限控件(LinearLayout / TextView / Chronometer / ImageButton 等),
|
|
|
|
|
|
高度压到 64dp 以内,避免在折叠态被系统裁切。
|
|
|
|
|
|
-->
|
|
|
|
|
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
|
|
|
android:layout_width="match_parent"
|
2026-11-28 01:14:09 +08:00
|
|
|
|
android:layout_height="wrap_content"
|
2026-11-28 01:07:24 +08:00
|
|
|
|
android:orientation="horizontal"
|
|
|
|
|
|
android:gravity="center_vertical"
|
|
|
|
|
|
android:paddingStart="16dp"
|
2026-11-28 01:14:09 +08:00
|
|
|
|
android:paddingEnd="6dp"
|
|
|
|
|
|
android:paddingTop="8dp"
|
|
|
|
|
|
android:paddingBottom="8dp">
|
2026-11-28 01:07:24 +08:00
|
|
|
|
|
|
|
|
|
|
<LinearLayout
|
|
|
|
|
|
android:layout_width="0dp"
|
|
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
|
|
android:layout_weight="1"
|
|
|
|
|
|
android:orientation="vertical"
|
|
|
|
|
|
android:gravity="center_vertical">
|
|
|
|
|
|
|
|
|
|
|
|
<TextView
|
|
|
|
|
|
android:id="@+id/tvNotifTask"
|
|
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
|
|
android:maxLines="1"
|
|
|
|
|
|
android:ellipsize="end"
|
|
|
|
|
|
android:textSize="14sp"
|
|
|
|
|
|
android:textStyle="bold"
|
|
|
|
|
|
android:textColor="?android:attr/textColorPrimary" />
|
|
|
|
|
|
|
|
|
|
|
|
<Chronometer
|
|
|
|
|
|
android:id="@+id/notifChrono"
|
|
|
|
|
|
android:layout_width="wrap_content"
|
|
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
|
|
android:layout_marginTop="2dp"
|
|
|
|
|
|
android:includeFontPadding="false"
|
|
|
|
|
|
android:textSize="13sp"
|
|
|
|
|
|
android:textColor="?android:attr/textColorSecondary" />
|
|
|
|
|
|
</LinearLayout>
|
|
|
|
|
|
|
|
|
|
|
|
<ImageButton
|
|
|
|
|
|
android:id="@+id/notifPause"
|
|
|
|
|
|
android:layout_width="44dp"
|
|
|
|
|
|
android:layout_height="44dp"
|
|
|
|
|
|
android:padding="10dp"
|
|
|
|
|
|
android:background="@android:color/transparent"
|
|
|
|
|
|
android:scaleType="fitCenter"
|
|
|
|
|
|
android:src="@drawable/ic_pause"
|
|
|
|
|
|
android:tint="?android:attr/textColorPrimary"
|
|
|
|
|
|
android:contentDescription="@string/notif_action_pause" />
|
|
|
|
|
|
|
|
|
|
|
|
<ImageButton
|
|
|
|
|
|
android:id="@+id/notifStop"
|
|
|
|
|
|
android:layout_width="44dp"
|
|
|
|
|
|
android:layout_height="44dp"
|
|
|
|
|
|
android:padding="10dp"
|
|
|
|
|
|
android:background="@android:color/transparent"
|
|
|
|
|
|
android:scaleType="fitCenter"
|
|
|
|
|
|
android:src="@drawable/ic_stop"
|
|
|
|
|
|
android:tint="?android:attr/textColorPrimary"
|
|
|
|
|
|
android:contentDescription="@string/notif_action_stop" />
|
|
|
|
|
|
</LinearLayout>
|