xref: /aosp_15_r20/frameworks/base/packages/SystemUI/res/layout/ongoing_activity_chip.xml (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1<!--
2  ~ Copyright (C) 2021 The Android Open Source Project
3  ~
4  ~ Licensed under the Apache License, Version 2.0 (the "License");
5  ~ you may not use this file except in compliance with the License.
6  ~ You may obtain a copy of the License at
7  ~
8  ~      http://www.apache.org/licenses/LICENSE-2.0
9  ~
10  ~ Unless required by applicable law or agreed to in writing, software
11  ~ distributed under the License is distributed on an "AS IS" BASIS,
12  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  ~ See the License for the specific language governing permissions and
14  ~ limitations under the License.
15  -->
16<!-- Have the wrapper frame layout match the parent height so that we get a larger touch area for
17     the chip. -->
18<FrameLayout
19    xmlns:android="http://schemas.android.com/apk/res/android"
20    android:layout_width="wrap_content"
21    android:layout_height="match_parent"
22    android:layout_gravity="center_vertical|start"
23    android:layout_marginStart="5dp"
24>
25    <!-- TODO(b/332662551): Update this content description when this supports more than just
26         phone calls. -->
27    <com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer
28        android:id="@+id/ongoing_activity_chip_background"
29        android:layout_width="wrap_content"
30        android:layout_height="@dimen/ongoing_appops_chip_height"
31        android:layout_gravity="center_vertical"
32        android:gravity="center"
33        android:background="@drawable/ongoing_activity_chip_bg"
34        android:paddingStart="@dimen/ongoing_activity_chip_side_padding"
35        android:paddingEnd="@dimen/ongoing_activity_chip_side_padding"
36        android:minWidth="@dimen/min_clickable_item_size"
37    >
38
39        <ImageView
40            android:src="@*android:drawable/ic_phone"
41            android:id="@+id/ongoing_activity_chip_icon"
42            android:contentDescription="@string/ongoing_phone_call_content_description"
43            android:layout_width="@dimen/ongoing_activity_chip_icon_size"
44            android:layout_height="@dimen/ongoing_activity_chip_icon_size"
45            android:tint="?android:attr/colorPrimary"
46        />
47
48        <!-- Only one of [ongoing_activity_chip_time, ongoing_activity_chip_text,
49             ongoing_activity_chip_short_time_delta] will ever be shown at one time. -->
50
51        <!-- Shows a timer, like 00:01. -->
52        <com.android.systemui.statusbar.chips.ui.view.ChipChronometer
53            android:id="@+id/ongoing_activity_chip_time"
54            style="@style/StatusBar.Chip.Text"
55        />
56
57        <!-- Shows generic text. -->
58        <!-- Since there's so little room in the status bar chip area, don't ellipsize the text and
59             instead just fade it out a bit at the end. -->
60        <TextView
61            android:id="@+id/ongoing_activity_chip_text"
62            style="@style/StatusBar.Chip.Text"
63            android:ellipsize="none"
64            android:requiresFadingEdge="horizontal"
65            android:fadingEdgeLength="@dimen/ongoing_activity_chip_text_fading_edge_length"
66            android:visibility="gone"
67            />
68
69        <!-- Shows a time delta in short form, like "15min" or "1hr". -->
70        <android.widget.DateTimeView
71            android:id="@+id/ongoing_activity_chip_short_time_delta"
72            style="@style/StatusBar.Chip.Text"
73            android:visibility="gone"
74            />
75
76    </com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer>
77</FrameLayout>
78