1<!--
2  ~ Copyright (C) 2023 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<com.android.wm.shell.compatui.RestartDialogLayout
17    xmlns:android="http://schemas.android.com/apk/res/android"
18    xmlns:app="http://schemas.android.com/apk/res-auto"
19    style="@style/LetterboxDialog">
20
21    <!-- The background of the top-level layout acts as the background dim. -->
22
23    <!-- Vertical margin will be set dynamically since it depends on task bounds.
24         Setting the alpha of the dialog container to 0, since it shouldn't be visible until the
25         enter animation starts. -->
26    <FrameLayout
27        android:id="@+id/letterbox_restart_dialog_container"
28        android:layout_width="0dp"
29        android:layout_height="wrap_content"
30        android:layout_marginHorizontal="@dimen/letterbox_restart_dialog_margin"
31        android:background="@drawable/letterbox_restart_dialog_background"
32        android:alpha="0"
33        app:layout_constraintTop_toTopOf="parent"
34        app:layout_constraintBottom_toBottomOf="parent"
35        app:layout_constraintStart_toStartOf="parent"
36        app:layout_constraintEnd_toEndOf="parent"
37        app:layout_constraintWidth_max="@dimen/letterbox_restart_dialog_width">
38
39        <!-- The ScrollView should only wrap the content of the dialog, otherwise the background
40             corner radius will be cut off when scrolling to the top/bottom. -->
41
42        <ScrollView android:layout_width="match_parent"
43                    android:layout_height="wrap_content">
44
45            <LinearLayout
46                android:padding="24dp"
47                android:layout_width="match_parent"
48                android:layout_height="wrap_content"
49                android:gravity="center_horizontal"
50                android:orientation="vertical">
51
52                <ImageView
53                    android:importantForAccessibility="no"
54                    android:layout_width="@dimen/letterbox_restart_dialog_title_icon_width"
55                    android:layout_height="@dimen/letterbox_restart_dialog_title_icon_height"
56                    android:src="@drawable/letterbox_restart_header_ic_arrows"/>
57
58                <TextView
59                    android:layout_marginVertical="16dp"
60                    android:id="@+id/letterbox_restart_dialog_title"
61                    android:layout_width="match_parent"
62                    android:layout_height="wrap_content"
63                    android:text="@string/letterbox_restart_dialog_title"
64                    android:textAlignment="center"
65                    android:textAppearance="@style/RestartDialogTitleText"/>
66
67                <TextView
68                    android:textAppearance="@style/RestartDialogBodyText"
69                    android:id="@+id/letterbox_restart_dialog_description"
70                    android:layout_width="match_parent"
71                    android:layout_height="wrap_content"
72                    android:text="@string/letterbox_restart_dialog_description"
73                    android:textAlignment="center"/>
74
75                <LinearLayout
76                    android:id="@+id/letterbox_restart_dialog_checkbox_container"
77                    android:layout_width="match_parent"
78                    android:layout_height="wrap_content"
79                    android:paddingVertical="14dp"
80                    android:orientation="horizontal"
81                    android:layout_gravity="center_vertical"
82                    android:layout_marginVertical="18dp">
83
84                    <CheckBox
85                        android:id="@+id/letterbox_restart_dialog_checkbox"
86                        android:layout_width="wrap_content"
87                        android:layout_height="wrap_content"
88                        android:button="@drawable/letterbox_restart_checkbox_button"/>
89
90                    <TextView
91                        android:textAppearance="@style/RestartDialogCheckboxText"
92                        android:layout_marginStart="12dp"
93                        android:id="@+id/letterbox_restart_dialog_checkbox_description"
94                        android:layout_width="match_parent"
95                        android:layout_height="wrap_content"
96                        android:text="@string/letterbox_restart_dialog_checkbox_title"
97                        android:textAlignment="textStart"/>
98
99                </LinearLayout>
100
101                <FrameLayout
102                    android:minHeight="@dimen/letterbox_restart_dialog_button_height"
103                    android:layout_width="match_parent"
104                    android:layout_height="wrap_content">
105
106                    <Button
107                        android:textAppearance="@style/RestartDialogDismissButton"
108                        android:id="@+id/letterbox_restart_dialog_dismiss_button"
109                        android:layout_width="wrap_content"
110                        android:layout_height="wrap_content"
111                        android:minWidth="@dimen/letterbox_restart_dialog_button_width"
112                        android:minHeight="@dimen/letterbox_restart_dialog_button_height"
113                        android:layout_gravity="start"
114                        android:background=
115                            "@drawable/letterbox_restart_dismiss_button_background_ripple"
116                        android:text="@string/letterbox_restart_cancel"
117                        android:contentDescription="@string/letterbox_restart_cancel"/>
118
119                    <Button
120                        android:textAppearance="@style/RestartDialogConfirmButton"
121                        android:id="@+id/letterbox_restart_dialog_restart_button"
122                        android:layout_width="wrap_content"
123                        android:layout_height="wrap_content"
124                        android:minWidth="@dimen/letterbox_restart_dialog_button_width"
125                        android:minHeight="@dimen/letterbox_restart_dialog_button_height"
126                        android:layout_gravity="end"
127                        android:background=
128                            "@drawable/letterbox_restart_button_background_ripple"
129                        android:text="@string/letterbox_restart_restart"
130                        android:contentDescription="@string/letterbox_restart_restart"/>
131
132                </FrameLayout>
133
134            </LinearLayout>
135
136        </ScrollView>
137
138    </FrameLayout>
139
140</com.android.wm.shell.compatui.RestartDialogLayout>