3ecc1aec9d99b589b1aab0652998028ba8164f7c
[PrivacyBrowser.git] / app / src / main / res / layout / import_export_coordinatorlayout.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2018 Soren Stoutner <soren@stoutner.com>.
5
6   This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
7
8   Privacy Browser is free software: you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation, either version 3 of the License, or
11   (at your option) any later version.
12
13   Privacy Browser is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with Privacy Browser.  If not, see <http://www.gnu.org/licenses/>. -->
20
21 <!-- `android:fitsSystemWindows="true"` moves the AppBar below the status bar.
22     When it is specified the theme should include `<item name="android:windowTranslucentStatus">true</item>` to make the status bar a transparent, darkened overlay. -->
23 <android.support.design.widget.CoordinatorLayout
24     android:id="@+id/import_export_coordinatorlayout"
25     xmlns:android="http://schemas.android.com/apk/res/android"
26     xmlns:app="http://schemas.android.com/apk/res-auto"
27     android:layout_height="match_parent"
28     android:layout_width="match_parent"
29     android:fitsSystemWindows="true" >
30
31     <!-- the `LinearLayout` with `orientation="vertical"` moves the content below the `AppBarLayout`. -->
32     <LinearLayout
33         android:layout_height="match_parent"
34         android:layout_width="match_parent"
35         android:orientation="vertical" >
36
37         <android.support.design.widget.AppBarLayout
38             android:id="@+id/import_export_appbarlayout"
39             android:layout_height="wrap_content"
40             android:layout_width="match_parent" >
41
42             <android.support.v7.widget.Toolbar
43                 android:id="@+id/import_export_toolbar"
44                 android:layout_height="wrap_content"
45                 android:layout_width="match_parent"
46                 android:background="?attr/colorPrimaryDark"
47                 android:theme="?attr/appBarTextTheme"
48                 app:popupTheme="?attr/popupsTheme" />
49         </android.support.design.widget.AppBarLayout>
50
51         <ScrollView
52             android:layout_height="match_parent"
53             android:layout_width="match_parent" >
54
55             <!-- Align the cards vertically. -->
56             <LinearLayout
57                 android:layout_height="wrap_content"
58                 android:layout_width="match_parent"
59                 android:orientation="vertical" >
60
61                 <!-- The export card. -->
62                 <android.support.v7.widget.CardView
63                     android:layout_height="wrap_content"
64                     android:layout_width="match_parent"
65                     android:layout_marginTop="10dp"
66                     android:layout_marginBottom="5dp"
67                     android:layout_marginStart="10dp"
68                     android:layout_marginEnd="10dp" >
69
70                     <!-- Align the contents of the card vertically. -->
71                     <LinearLayout
72                         android:layout_height="match_parent"
73                         android:layout_width="match_parent"
74                         android:orientation="vertical"
75                         android:layout_margin="10dp" >
76
77                         <TextView
78                             android:layout_width="wrap_content"
79                             android:layout_height="wrap_content"
80                             android:layout_gravity="center_horizontal"
81                             android:layout_marginBottom="6dp"
82                             android:text="@string/export_settings"
83                             android:textSize="25sp"
84                             android:textStyle="bold"
85                             android:textColor="?android:textColorPrimary" />
86
87                         <!-- Align the export EditText and the select file button horizontally. -->
88                         <LinearLayout
89                             android:layout_height="wrap_content"
90                             android:layout_width="match_parent"
91                             android:orientation="horizontal" >
92
93                             <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
94                             <android.support.design.widget.TextInputLayout
95                                 android:layout_height="wrap_content"
96                                 android:layout_width="0dp"
97                                 android:layout_weight="1" >
98
99                                 <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
100                                 <android.support.design.widget.TextInputEditText
101                                     android:id="@+id/export_file_edittext"
102                                     android:layout_height="wrap_content"
103                                     android:layout_width="match_parent"
104                                     android:hint="@string/export_file_name"
105                                     android:inputType="textMultiLine|textUri" />
106                             </android.support.design.widget.TextInputLayout>
107
108                             <Button
109                                 android:id="@+id/select_export_file"
110                                 android:layout_height="wrap_content"
111                                 android:layout_width="wrap_content"
112                                 android:layout_gravity="center_vertical"
113                                 android:text="@string/browse"
114                                 android:onClick="exportBrowse" />
115                         </LinearLayout>
116
117                         <Button
118                             android:id="@+id/export_button"
119                             android:layout_height="wrap_content"
120                             android:layout_width="wrap_content"
121                             android:layout_gravity="center_horizontal"
122                             android:text="@string/export"
123                             android:textSize="18sp"
124                             android:onClick="onClickExport" />
125                     </LinearLayout>
126                 </android.support.v7.widget.CardView>
127
128                 <!-- The import card. -->
129                 <android.support.v7.widget.CardView
130                     android:layout_height="wrap_content"
131                     android:layout_width="match_parent"
132                     android:layout_marginTop="5dp"
133                     android:layout_marginBottom="10dp"
134                     android:layout_marginStart="10dp"
135                     android:layout_marginEnd="10dp" >
136
137                     <!-- Align the contents of the card vertically. -->
138                     <LinearLayout
139                         android:layout_height="match_parent"
140                         android:layout_width="match_parent"
141                         android:orientation="vertical"
142                         android:layout_margin="10dp" >
143
144                         <TextView
145                             android:layout_width="wrap_content"
146                             android:layout_height="wrap_content"
147                             android:layout_gravity="center_horizontal"
148                             android:layout_marginBottom="6dp"
149                             android:text="@string/import_settings"
150                             android:textSize="25sp"
151                             android:textStyle="bold"
152                             android:textColor="?android:textColorPrimary" />
153
154                         <!-- Align the import EditText and the select file button horizontally. -->
155                         <LinearLayout
156                             android:layout_height="wrap_content"
157                             android:layout_width="match_parent"
158                             android:orientation="horizontal" >
159
160                             <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
161                             <android.support.design.widget.TextInputLayout
162                                 android:layout_height="wrap_content"
163                                 android:layout_width="0dp"
164                                 android:layout_weight="1" >
165
166                                 <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
167                                 <android.support.design.widget.TextInputEditText
168                                     android:id="@+id/import_file_edittext"
169                                     android:layout_height="wrap_content"
170                                     android:layout_width="match_parent"
171                                     android:hint="@string/import_file_name"
172                                     android:inputType="textMultiLine|textUri" />
173                             </android.support.design.widget.TextInputLayout>
174
175                             <Button
176                                 android:id="@+id/select_import_file"
177                                 android:layout_height="wrap_content"
178                                 android:layout_width="wrap_content"
179                                 android:layout_gravity="center_vertical"
180                                 android:text="@string/browse"
181                                 android:onClick="importBrowse" />
182                         </LinearLayout>
183
184                         <!-- `import` is a reserved word and cannot be used for the `onClick` name. -->
185                         <Button
186                             android:id="@+id/import_button"
187                             android:layout_height="wrap_content"
188                             android:layout_width="wrap_content"
189                             android:layout_gravity="center_horizontal"
190                             android:text="@string/import_button"
191                             android:textSize="18sp"
192                             android:onClick="onClickImport" />
193                     </LinearLayout>
194                 </android.support.v7.widget.CardView>
195
196                 <TextView
197                     android:id="@+id/import_export_storage_permission_textview"
198                     android:layout_width="wrap_content"
199                     android:layout_height="wrap_content"
200                     android:layout_gravity="center_horizontal"
201                     android:layout_marginBottom="10dp"
202                     android:layout_marginStart="15dp"
203                     android:layout_marginEnd="15dp"
204                     android:text="@string/storage_permission_explanation"
205                     android:textColor="?android:textColorPrimary"
206                     android:textAlignment="center" />
207             </LinearLayout>
208         </ScrollView>
209     </LinearLayout>
210 </android.support.design.widget.CoordinatorLayout>