1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2020 The Android Open Source Project
4  ~
5  ~ Licensed under the Apache License, Version 2.0 (the "License");
6  ~ you may not use this file except in compliance with the License.
7  ~ You may obtain a copy of the License at
8  ~
9  ~      http://www.apache.org/licenses/LICENSE-2.0
10  ~
11  ~ Unless required by applicable law or agreed to in writing, software
12  ~ distributed under the License is distributed on an "AS IS" BASIS,
13  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  ~ See the License for the specific language governing permissions and
15  ~ limitations under the License
16  -->
17<com.android.internal.widget.ConversationLayout
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    android:id="@+id/status_bar_latest_event_content"
20    android:layout_width="match_parent"
21    android:layout_height="wrap_content"
22    android:clipChildren="false"
23    android:tag="conversation"
24    android:theme="@style/Theme.DeviceDefault.Notification"
25    >
26
27    <FrameLayout
28        android:id="@+id/conversation_icon_container"
29        android:layout_width="@dimen/conversation_content_start"
30        android:layout_height="wrap_content"
31        android:gravity="start|top"
32        android:clipChildren="false"
33        android:clipToPadding="false"
34        android:paddingTop="12dp"
35        android:paddingBottom="12dp"
36    >
37
38        <FrameLayout
39            android:layout_width="wrap_content"
40            android:layout_height="wrap_content"
41            android:clipChildren="false"
42            android:clipToPadding="false"
43            android:layout_gravity="top|center_horizontal"
44        >
45
46            <!-- Big icon: 52x52, 12dp padding left + top, 16dp padding right -->
47            <com.android.internal.widget.CachingIconView
48                android:id="@+id/conversation_icon"
49                android:layout_width="@dimen/conversation_avatar_size"
50                android:layout_height="@dimen/conversation_avatar_size"
51                android:scaleType="centerCrop"
52                android:importantForAccessibility="no"
53            />
54
55            <ViewStub
56                android:layout="@layout/conversation_face_pile_layout"
57                android:layout_width="@dimen/conversation_avatar_size"
58                android:layout_height="@dimen/conversation_avatar_size"
59                android:id="@+id/conversation_face_pile"
60                />
61
62            <FrameLayout
63                android:id="@+id/conversation_icon_badge"
64                android:layout_width="@dimen/conversation_icon_size_badged"
65                android:layout_height="@dimen/conversation_icon_size_badged"
66                android:layout_marginLeft="@dimen/conversation_badge_side_margin"
67                android:layout_marginTop="@dimen/conversation_badge_side_margin"
68                android:clipChildren="false"
69                android:clipToPadding="false"
70            >
71                <com.android.internal.widget.CachingIconView
72                    android:id="@+id/conversation_icon_badge_bg"
73                    android:layout_width="match_parent"
74                    android:layout_height="match_parent"
75                    android:layout_gravity="center"
76                    android:src="@drawable/conversation_badge_background"
77                    android:forceHasOverlappingRendering="false"
78                    android:scaleType="center"
79                />
80                <com.android.internal.widget.CachingIconView
81                    android:id="@+id/icon"
82                    android:layout_width="match_parent"
83                    android:layout_height="match_parent"
84                    android:layout_margin="4dp"
85                    android:layout_gravity="center"
86                    android:forceHasOverlappingRendering="false"
87                />
88                <com.android.internal.widget.CachingIconView
89                    android:id="@+id/conversation_icon_badge_ring"
90                    android:layout_width="wrap_content"
91                    android:layout_height="wrap_content"
92                    android:layout_gravity="center"
93                    android:src="@drawable/conversation_badge_ring"
94                    android:visibility="gone"
95                    android:forceHasOverlappingRendering="false"
96                    android:clipToPadding="false"
97                    android:scaleType="center"
98                />
99            </FrameLayout>
100        </FrameLayout>
101    </FrameLayout>
102
103    <!-- Wraps entire "expandable" notification -->
104    <com.android.internal.widget.RemeasuringLinearLayout
105        android:layout_width="match_parent"
106        android:layout_height="wrap_content"
107        android:layout_gravity="top"
108        android:clipToPadding="false"
109        android:clipChildren="false"
110        android:orientation="vertical"
111        >
112        <!-- LinearLayout for Expand Button-->
113        <com.android.internal.widget.RemeasuringLinearLayout
114            android:id="@+id/expand_button_and_content_container"
115            android:layout_width="match_parent"
116            android:layout_height="wrap_content"
117            android:layout_weight="1"
118            android:gravity="start|top"
119            android:orientation="horizontal"
120            android:clipChildren="false"
121            android:clipToPadding="false">
122            <!--TODO: move this into a separate layout and share logic with the header to bring back app opps etc-->
123            <com.android.internal.widget.RemeasuringLinearLayout
124                android:id="@+id/notification_action_list_margin_target"
125                android:layout_width="0dp"
126                android:orientation="vertical"
127                android:layout_height="wrap_content"
128                android:layout_weight="1">
129
130                <!-- Header -->
131
132                <!-- Use layout_marginStart instead of paddingStart to work around strange
133                     measurement behavior on lower display densities. -->
134                <LinearLayout
135                    android:id="@+id/conversation_header"
136                    android:layout_width="wrap_content"
137                    android:layout_height="wrap_content"
138                    android:orientation="horizontal"
139                    android:paddingTop="16dp"
140                    android:layout_marginBottom="2dp"
141                    android:layout_marginStart="@dimen/conversation_content_start"
142                >
143                    <TextView
144                        android:id="@+id/conversation_text"
145                        android:layout_width="wrap_content"
146                        android:layout_height="wrap_content"
147                        android:layout_marginEnd="@dimen/notification_conversation_header_separating_margin"
148                        android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Title"
149                        android:textSize="16sp"
150                        android:singleLine="true"
151                        android:layout_weight="1"
152                        />
153
154                    <TextView
155                        android:id="@+id/app_name_divider"
156                        android:layout_width="wrap_content"
157                        android:layout_height="wrap_content"
158                        android:textAppearance="?attr/notificationHeaderTextAppearance"
159                        android:layout_marginStart="@dimen/notification_conversation_header_separating_margin"
160                        android:layout_marginEnd="@dimen/notification_conversation_header_separating_margin"
161                        android:text="@string/notification_header_divider_symbol"
162                        android:layout_gravity="center"
163                        android:paddingTop="1sp"
164                        android:singleLine="true"
165                        android:visibility="gone"
166                    />
167
168                    <!-- App Name -->
169                    <com.android.internal.widget.ObservableTextView
170                        android:id="@+id/app_name_text"
171                        android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Info"
172                        android:layout_width="wrap_content"
173                        android:layout_height="wrap_content"
174                        android:layout_gravity="center"
175                        android:layout_marginStart="@dimen/notification_conversation_header_separating_margin"
176                        android:layout_marginEnd="@dimen/notification_conversation_header_separating_margin"
177                        android:paddingTop="1sp"
178                        android:singleLine="true"
179                        android:visibility="gone"
180                    />
181
182                    <TextView
183                        android:id="@+id/time_divider"
184                        android:layout_width="wrap_content"
185                        android:layout_height="wrap_content"
186                        android:textAppearance="?attr/notificationHeaderTextAppearance"
187                        android:layout_marginStart="@dimen/notification_conversation_header_separating_margin"
188                        android:layout_marginEnd="@dimen/notification_conversation_header_separating_margin"
189                        android:text="@string/notification_header_divider_symbol"
190                        android:layout_gravity="center"
191                        android:paddingTop="1sp"
192                        android:singleLine="true"
193                        android:visibility="gone"
194                    />
195
196                    <DateTimeView
197                        android:id="@+id/time"
198                        android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Time"
199                        android:layout_width="wrap_content"
200                        android:layout_height="wrap_content"
201                        android:layout_gravity="center"
202                        android:layout_marginStart="@dimen/notification_conversation_header_separating_margin"
203                        android:paddingTop="1sp"
204                        android:showRelative="true"
205                        android:singleLine="true"
206                        android:visibility="gone"
207                    />
208
209                    <ImageView
210                        android:id="@+id/alerted_icon"
211                        android:layout_width="@dimen/notification_alerted_size"
212                        android:layout_height="@dimen/notification_alerted_size"
213                        android:layout_gravity="center"
214                        android:layout_marginStart="4dp"
215                        android:paddingTop="2dp"
216                        android:scaleType="fitCenter"
217                        android:visibility="gone"
218                        android:contentDescription="@string/notification_alerted_content_description"
219                        android:src="@drawable/ic_notifications_alerted"/>
220
221                    <ImageView
222                        android:id="@+id/profile_badge"
223                        android:layout_width="@dimen/notification_badge_size"
224                        android:layout_height="@dimen/notification_badge_size"
225                        android:layout_gravity="center"
226                        android:layout_marginStart="4dp"
227                        android:paddingTop="2dp"
228                        android:scaleType="fitCenter"
229                        android:visibility="gone"
230                        android:contentDescription="@string/notification_work_profile_content_description"
231                    />
232                    <LinearLayout
233                        android:id="@+id/app_ops"
234                        android:layout_height="wrap_content"
235                        android:layout_width="wrap_content"
236                        android:paddingTop="3dp"
237                        android:layout_marginStart="2dp"
238                        android:background="?android:selectableItemBackgroundBorderless"
239                        android:orientation="horizontal" >
240                        <ImageView
241                            android:layout_marginStart="4dp"
242                            android:id="@+id/camera"
243                            android:layout_width="?attr/notificationHeaderIconSize"
244                            android:layout_height="?attr/notificationHeaderIconSize"
245                            android:src="@drawable/ic_camera"
246                            android:visibility="gone"
247                            android:focusable="false"
248                            android:contentDescription="@string/notification_appops_camera_active"
249                            />
250                        <ImageView
251                            android:id="@+id/mic"
252                            android:layout_width="?attr/notificationHeaderIconSize"
253                            android:layout_height="?attr/notificationHeaderIconSize"
254                            android:src="@drawable/ic_mic"
255                            android:layout_marginStart="4dp"
256                            android:visibility="gone"
257                            android:focusable="false"
258                            android:contentDescription="@string/notification_appops_microphone_active"
259                            />
260                        <ImageView
261                            android:id="@+id/overlay"
262                            android:layout_width="?attr/notificationHeaderIconSize"
263                            android:layout_height="?attr/notificationHeaderIconSize"
264                            android:src="@drawable/ic_alert_window_layer"
265                            android:layout_marginStart="4dp"
266                            android:visibility="gone"
267                            android:focusable="false"
268                            android:contentDescription="@string/notification_appops_overlay_active"
269                            />
270                    </LinearLayout>
271                </LinearLayout>
272
273                <!-- Messages -->
274                <com.android.internal.widget.MessagingLinearLayout
275                    android:id="@+id/notification_messaging"
276                    android:layout_width="match_parent"
277                    android:layout_height="wrap_content"
278                    android:minHeight="@dimen/notification_text_size"
279                    android:spacing="@dimen/notification_messaging_spacing"
280                    android:clipToPadding="false"
281                    android:clipChildren="false"
282                    />
283            </com.android.internal.widget.RemeasuringLinearLayout>
284
285            <!-- This is where the expand button container will be placed when collapsed-->
286        </com.android.internal.widget.RemeasuringLinearLayout>
287
288        <include layout="@layout/notification_template_smart_reply_container"
289            android:layout_width="match_parent"
290            android:layout_height="wrap_content"
291            android:layout_marginTop="@dimen/notification_content_margin"
292            android:layout_marginStart="@dimen/conversation_content_start"
293            android:layout_marginEnd="@dimen/notification_content_margin_end" />
294        <include layout="@layout/notification_material_action_list" />
295    </com.android.internal.widget.RemeasuringLinearLayout>
296
297    <!--This is dynamically placed between here and at the end of the layout. It starts here since
298        only FrameLayout layout params have gravity-->
299    <FrameLayout
300        android:id="@+id/expand_button_container"
301        android:layout_width="wrap_content"
302        android:layout_height="match_parent"
303        android:layout_gravity="end|top"
304        android:clipChildren="false"
305        android:clipToPadding="false">
306        <!--This layout makes sure that we can nicely center the expand content in the
307            collapsed layout while the parent makes sure that we're never laid out bigger
308            than the messaging content.-->
309        <LinearLayout
310            android:id="@+id/expand_button_inner_container"
311            android:layout_width="wrap_content"
312            android:layout_height="@dimen/conversation_expand_button_size"
313            android:paddingStart="16dp"
314            android:orientation="horizontal"
315            android:layout_gravity="end|top"
316            android:paddingEnd="@dimen/notification_content_margin_end"
317            android:clipToPadding="false"
318            android:clipChildren="false"
319            >
320            <!-- Images -->
321            <com.android.internal.widget.MessagingLinearLayout
322                android:id="@+id/conversation_image_message_container"
323                android:forceHasOverlappingRendering="false"
324                android:layout_width="40dp"
325                android:layout_height="40dp"
326                android:layout_marginEnd="11dp"
327                android:spacing="0dp"
328                android:layout_gravity="center"
329                android:clipToPadding="false"
330                android:clipChildren="false"
331                />
332            <!-- Unread Count -->
333            <TextView
334                android:id="@+id/conversation_unread_count"
335                android:layout_width="33sp"
336                android:layout_height="wrap_content"
337                android:layout_marginEnd="11dp"
338                android:layout_gravity="center"
339                android:gravity="center"
340                android:padding="2dp"
341                android:visibility="gone"
342                android:textAppearance="@style/TextAppearance.DeviceDefault.Notification"
343                android:textColor="#FFFFFF"
344                android:textSize="12sp"
345                android:background="@drawable/conversation_unread_bg"
346                />
347            <com.android.internal.widget.NotificationExpandButton
348                android:id="@+id/expand_button"
349                android:layout_width="@dimen/notification_header_expand_icon_size"
350                android:layout_height="@dimen/notification_header_expand_icon_size"
351                android:layout_gravity="center"
352                android:drawable="@drawable/ic_expand_notification"
353                android:clickable="false"
354                android:importantForAccessibility="no"
355                />
356        </LinearLayout>
357    </FrameLayout>
358</com.android.internal.widget.ConversationLayout>
359