1<?xml version="1.0" encoding="utf-8"?>
2<!--
3  ~ Copyright (C) 2021 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.systemui.clipboardoverlay.ClipboardOverlayView
18    xmlns:android="http://schemas.android.com/apk/res/android"
19    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
20    xmlns:app="http://schemas.android.com/apk/res-auto"
21    android:id="@+id/clipboard_ui"
22    android:theme="@style/FloatingOverlay"
23    android:alpha="0"
24    android:layout_width="match_parent"
25    android:layout_height="match_parent"
26    android:contentDescription="@string/clipboard_overlay_window_name">
27    <!-- Min edge spacing guideline off of which the preview and actions can be anchored (without
28         this we'd need to express margins as the sum of two different dimens). -->
29    <androidx.constraintlayout.widget.Guideline
30        android:layout_width="wrap_content"
31        android:layout_height="wrap_content"
32        android:id="@+id/min_edge_guideline"
33        app:layout_constraintGuide_begin="@dimen/overlay_action_container_minimum_edge_spacing"
34        android:orientation="vertical"/>
35    <!-- Negative horizontal margin because this container background must render beyond the thing
36         it's constrained by (the actions themselves). -->
37    <FrameLayout
38        android:id="@+id/actions_container_background"
39        android:visibility="gone"
40        android:layout_height="0dp"
41        android:layout_width="0dp"
42        android:elevation="4dp"
43        android:background="@drawable/shelf_action_chip_container_background"
44        android:layout_marginStart="@dimen/negative_overlay_action_container_minimum_edge_spacing"
45        android:layout_marginEnd="@dimen/negative_overlay_action_container_minimum_edge_spacing"
46        android:layout_marginBottom="@dimen/overlay_action_container_margin_bottom"
47        app:layout_constraintStart_toStartOf="@id/min_edge_guideline"
48        app:layout_constraintTop_toTopOf="@id/actions_container"
49        app:layout_constraintEnd_toEndOf="@id/actions_container"
50        app:layout_constraintBottom_toBottomOf="parent"/>
51    <HorizontalScrollView
52        android:id="@+id/actions_container"
53        android:layout_width="0dp"
54        android:layout_height="wrap_content"
55        android:layout_marginEnd="@dimen/overlay_action_container_margin_horizontal"
56        android:paddingEnd="@dimen/overlay_action_container_padding_end"
57        android:paddingVertical="@dimen/overlay_action_container_padding_vertical"
58        android:elevation="4dp"
59        android:scrollbars="none"
60        app:layout_constraintHorizontal_bias="0"
61        app:layout_constraintWidth_percent="1.0"
62        app:layout_constraintWidth_max="wrap"
63        app:layout_constraintStart_toEndOf="@+id/preview_border"
64        app:layout_constraintEnd_toEndOf="parent"
65        app:layout_constraintBottom_toBottomOf="@id/actions_container_background">
66        <LinearLayout
67            android:id="@+id/actions"
68            android:layout_width="wrap_content"
69            android:layout_height="wrap_content"
70            android:paddingStart="@dimen/shelf_action_chip_margin_start"
71            android:showDividers="middle"
72            android:divider="@drawable/shelf_action_chip_divider"
73            android:animateLayoutChanges="true">
74            <include layout="@layout/shelf_action_chip"
75                     android:id="@+id/share_chip"/>
76            <include layout="@layout/shelf_action_chip"
77                     android:id="@+id/remote_copy_chip"/>
78        </LinearLayout>
79    </HorizontalScrollView>
80    <View
81        android:id="@+id/preview_border"
82        android:layout_width="0dp"
83        android:layout_height="0dp"
84        android:layout_marginStart="@dimen/overlay_preview_container_margin"
85        android:layout_marginTop="@dimen/overlay_border_width_neg"
86        android:layout_marginEnd="@dimen/overlay_border_width_neg"
87        android:layout_marginBottom="@dimen/overlay_preview_container_margin"
88        android:elevation="7dp"
89        android:background="@drawable/overlay_border"
90        app:layout_constraintStart_toStartOf="@id/min_edge_guideline"
91        app:layout_constraintTop_toTopOf="@id/clipboard_preview"
92        app:layout_constraintEnd_toEndOf="@id/clipboard_preview"
93        app:layout_constraintBottom_toBottomOf="@id/actions_container_background"/>
94    <FrameLayout
95        android:id="@+id/clipboard_preview"
96        android:layout_width="@dimen/clipboard_preview_size"
97        android:layout_height="wrap_content"
98        android:layout_marginStart="@dimen/overlay_border_width"
99        android:layout_marginBottom="@dimen/overlay_border_width"
100        android:layout_gravity="center"
101        android:elevation="7dp"
102        android:background="@drawable/overlay_preview_background"
103        android:clipChildren="true"
104        android:clipToOutline="true"
105        android:clipToPadding="true"
106        app:layout_constraintStart_toStartOf="@id/preview_border"
107        app:layout_constraintBottom_toBottomOf="@id/preview_border">
108        <TextView android:id="@+id/text_preview"
109                  android:textFontWeight="500"
110                  android:padding="8dp"
111                  android:gravity="center|start"
112                  android:ellipsize="end"
113                  android:autoSizeTextType="uniform"
114                  android:autoSizeMinTextSize="@dimen/clipboard_overlay_min_font"
115                  android:autoSizeMaxTextSize="@dimen/clipboard_overlay_max_font"
116                  android:textColor="?attr/overlayButtonTextColor"
117                  android:textColorLink="?attr/overlayButtonTextColor"
118                  android:background="?androidprv:attr/colorAccentSecondary"
119                  android:layout_width="@dimen/clipboard_preview_size"
120                  android:layout_height="@dimen/clipboard_preview_size"/>
121        <ImageView
122            android:id="@+id/image_preview"
123            android:scaleType="fitCenter"
124            android:adjustViewBounds="true"
125            android:contentDescription="@string/clipboard_image_preview"
126            android:layout_width="match_parent"
127            android:layout_height="wrap_content"/>
128        <TextView
129            android:id="@+id/hidden_preview"
130            android:visibility="gone"
131            android:textFontWeight="500"
132            android:padding="8dp"
133            android:gravity="center"
134            android:textSize="14sp"
135            android:textColor="?attr/overlayButtonTextColor"
136            android:background="?androidprv:attr/colorAccentSecondary"
137            android:layout_width="@dimen/clipboard_preview_size"
138            android:layout_height="@dimen/clipboard_preview_size"/>
139    </FrameLayout>
140    <LinearLayout
141        android:id="@+id/minimized_preview"
142        android:layout_width="wrap_content"
143        android:layout_height="wrap_content"
144        android:visibility="gone"
145        android:elevation="7dp"
146        android:padding="8dp"
147        app:layout_constraintBottom_toBottomOf="parent"
148        app:layout_constraintStart_toStartOf="parent"
149        android:layout_marginStart="@dimen/overlay_action_container_margin_horizontal"
150        android:layout_marginBottom="@dimen/overlay_action_container_margin_bottom"
151        android:background="@drawable/clipboard_minimized_background">
152        <ImageView
153            android:src="@drawable/ic_content_paste"
154            android:tint="?attr/overlayButtonTextColor"
155            android:layout_width="24dp"
156            android:layout_height="24dp"/>
157        <ImageView
158            android:src="@*android:drawable/ic_chevron_end"
159            android:tint="?attr/overlayButtonTextColor"
160            android:layout_width="24dp"
161            android:layout_height="24dp"
162            android:paddingEnd="-8dp"
163            android:paddingStart="-4dp"/>
164    </LinearLayout>
165    <androidx.constraintlayout.widget.Barrier
166        android:id="@+id/clipboard_content_top"
167        android:layout_width="wrap_content"
168        android:layout_height="wrap_content"
169        android:orientation="horizontal"
170        app:barrierDirection="top"
171        app:constraint_referenced_ids="clipboard_preview,minimized_preview"/>
172    <androidx.constraintlayout.widget.Barrier
173        android:id="@+id/clipboard_content_end"
174        android:layout_width="wrap_content"
175        android:layout_height="wrap_content"
176        android:orientation="vertical"
177        app:barrierDirection="end"
178        app:constraint_referenced_ids="clipboard_preview,minimized_preview"/>
179    <FrameLayout
180        android:id="@+id/dismiss_button"
181        android:layout_width="@dimen/overlay_dismiss_button_tappable_size"
182        android:layout_height="@dimen/overlay_dismiss_button_tappable_size"
183        android:elevation="10dp"
184        android:visibility="gone"
185        android:alpha="0"
186        app:layout_constraintStart_toEndOf="@id/clipboard_content_end"
187        app:layout_constraintEnd_toEndOf="@id/clipboard_content_end"
188        app:layout_constraintTop_toTopOf="@id/clipboard_content_top"
189        app:layout_constraintBottom_toTopOf="@id/clipboard_content_top"
190        android:contentDescription="@string/clipboard_dismiss_description">
191        <ImageView
192            android:id="@+id/dismiss_image"
193            android:layout_width="match_parent"
194            android:layout_height="match_parent"
195            android:layout_margin="@dimen/overlay_dismiss_button_margin"
196            android:background="@drawable/circular_background"
197            android:backgroundTint="?androidprv:attr/materialColorPrimaryFixedDim"
198            android:tint="?androidprv:attr/materialColorOnPrimaryFixed"
199            android:padding="4dp"
200            android:src="@drawable/ic_close"/>
201    </FrameLayout>
202</com.android.systemui.clipboardoverlay.ClipboardOverlayView>