1 <?xml version="1.0" encoding="utf-8"?>
4 SPDX-License-Identifier: GPL-3.0-or-later
5 SPDX-FileCopyrightText: 2018-2024 Soren Stoutner <soren@stoutner.com>
7 This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android/>.
9 This program is free software: you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation, either version 3 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program. If not, see <https://www.gnu.org/licenses/>. -->
22 <!-- `android:fitsSystemWindows="true"` is required for correct layout starting with API >= 35 (Android 15) -->
23 <androidx.coordinatorlayout.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" >
31 <!-- The linear layout with `orientation="vertical"` keeps the content above the app bar layout. -->
33 android:layout_height="match_parent"
34 android:layout_width="match_parent"
35 android:orientation="vertical" >
38 android:id="@+id/scrollview"
39 android:layout_height="0dp"
40 android:layout_width="match_parent"
41 android:layout_weight="1" >
43 <!-- Align the content vertically. -->
45 android:layout_height="wrap_content"
46 android:layout_width="match_parent"
47 android:orientation="vertical"
48 android:layout_marginTop="10dp" >
50 <!-- Settings and Bookmarks. -->
52 android:layout_height="wrap_content"
53 android:layout_width="match_parent"
54 android:gravity="center_horizontal"
55 android:text="@string/bookmarks_and_settings"
56 android:textSize="30sp"
57 android:textStyle="bold"
58 android:textColor="?android:textColorPrimary" />
61 android:layout_height="wrap_content"
62 android:layout_width="match_parent"
63 android:gravity="center_horizontal"
64 android:layout_marginBottom="10dp"
65 android:text="@string/sqlite_database_format"
66 android:textSize="14sp" />
68 <!-- The encryption card. -->
69 <androidx.cardview.widget.CardView
70 android:layout_height="wrap_content"
71 android:layout_width="match_parent"
72 android:layout_marginStart="10dp"
73 android:layout_marginEnd="10dp"
74 android:layout_marginBottom="5dp" >
76 <!-- Align the contents of the card vertically. -->
78 android:layout_height="match_parent"
79 android:layout_width="match_parent"
80 android:orientation="vertical"
81 android:layout_marginTop="10dp"
82 android:layout_marginBottom="20dp"
83 android:layout_marginStart="10dp"
84 android:layout_marginEnd="10dp" >
87 android:layout_width="wrap_content"
88 android:layout_height="wrap_content"
89 android:layout_gravity="center_horizontal"
90 android:layout_marginBottom="6dp"
91 android:text="@string/encryption"
92 android:textSize="25sp"
93 android:textStyle="bold"
94 android:textColor="?colorAccent" />
97 android:id="@+id/encryption_spinner"
98 android:layout_height="wrap_content"
99 android:layout_width="wrap_content"
100 android:layout_gravity="center_horizontal" />
102 <!-- The encryption password. -->
103 <com.google.android.material.textfield.TextInputLayout
104 android:id="@+id/encryption_password_textinputlayout"
105 android:layout_height="wrap_content"
106 android:layout_width="match_parent"
107 app:passwordToggleEnabled="true" >
109 <com.google.android.material.textfield.TextInputEditText
110 android:id="@+id/encryption_password_edittext"
111 android:layout_height="wrap_content"
112 android:layout_width="match_parent"
113 android:hint="@string/password"
114 android:inputType="textPassword"/>
115 </com.google.android.material.textfield.TextInputLayout>
117 <!-- OpenKeychain required message. -->
119 android:id="@+id/openkeychain_required_textview"
120 android:layout_height="wrap_content"
121 android:layout_width="wrap_content"
122 android:layout_gravity="center_horizontal"
123 android:layout_marginTop="10dp"
124 android:text="@string/openkeychain_required"
125 android:textAlignment="center" />
127 </androidx.cardview.widget.CardView>
129 <!-- The bookmarks and settings file location card. -->
130 <androidx.cardview.widget.CardView
131 android:id="@+id/settings_file_location_cardview"
132 android:layout_height="wrap_content"
133 android:layout_width="match_parent"
134 android:layout_marginTop="5dp"
135 android:layout_marginBottom="5dp"
136 android:layout_marginStart="10dp"
137 android:layout_marginEnd="10dp" >
139 <!-- Align the contents of the card vertically. -->
141 android:layout_height="match_parent"
142 android:layout_width="match_parent"
143 android:orientation="vertical"
144 android:layout_marginTop="10dp"
145 android:layout_marginBottom="20dp"
146 android:layout_marginStart="10dp"
147 android:layout_marginEnd="10dp" >
150 android:layout_width="wrap_content"
151 android:layout_height="wrap_content"
152 android:layout_gravity="center_horizontal"
153 android:layout_marginBottom="6dp"
154 android:text="@string/file_location"
155 android:textSize="25sp"
156 android:textStyle="bold"
157 android:textColor="?colorAccent" />
160 android:layout_height="wrap_content"
161 android:layout_width="wrap_content"
162 android:layout_gravity="center_horizontal"
163 android:orientation="horizontal" >
166 android:id="@+id/settings_import_radiobutton"
167 android:layout_height="wrap_content"
168 android:layout_width="wrap_content"
169 android:text="@string/import_button"
170 android:layout_marginEnd="10dp"
171 android:onClick="onClickSettingsRadioButton" />
174 android:id="@+id/settings_export_radiobutton"
175 android:layout_height="wrap_content"
176 android:layout_width="wrap_content"
177 android:text="@string/export"
178 android:onClick="onClickSettingsRadioButton" />
181 <!-- Align the edit text and the select file button horizontally. -->
183 android:id="@+id/settings_file_name_linearlayout"
184 android:layout_height="wrap_content"
185 android:layout_width="match_parent"
186 android:orientation="horizontal"
187 android:layout_marginTop="10dp">
189 <!-- The text input layout makes the hint float above the edit text. -->
190 <com.google.android.material.textfield.TextInputLayout
191 android:layout_height="wrap_content"
192 android:layout_width="0dp"
193 android:layout_weight="1" >
195 <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
196 <com.google.android.material.textfield.TextInputEditText
197 android:id="@+id/settings_file_name_edittext"
198 android:layout_height="wrap_content"
199 android:layout_width="match_parent"
200 android:hint="@string/file_name"
201 android:inputType="textMultiLine|textUri" />
202 </com.google.android.material.textfield.TextInputLayout>
205 android:id="@+id/settings_browse_button"
206 android:layout_height="wrap_content"
207 android:layout_width="wrap_content"
208 android:layout_gravity="center_vertical"
209 android:text="@string/browse"
210 android:onClick="settingsBrowse" />
213 <!-- OpenKeychain import instructions -->
215 android:id="@+id/openkeychain_import_instructions_textview"
216 android:layout_height="wrap_content"
217 android:layout_width="wrap_content"
218 android:layout_gravity="center_horizontal"
219 android:layout_margin="5dp"
220 android:text="@string/openkeychain_import_instructions"
221 android:textAlignment="center" />
224 android:id="@+id/settings_import_export_button"
225 android:layout_height="wrap_content"
226 android:layout_width="wrap_content"
227 android:layout_gravity="center_horizontal"
228 android:layout_marginTop="10dp"
229 android:text="@string/import_button"
230 android:textSize="18sp"
231 android:onClick="importExportSettings"
232 app:backgroundTint="@color/button_background_selector"
233 android:textColor="@color/button_text_selector" />
235 </androidx.cardview.widget.CardView>
239 android:layout_height="wrap_content"
240 android:layout_width="match_parent"
241 android:gravity="center_horizontal"
242 android:layout_marginTop="30dp"
243 android:text="@string/bookmarks"
244 android:textSize="30sp"
245 android:textStyle="bold"
246 android:textColor="?android:textColorPrimary" />
249 android:layout_height="wrap_content"
250 android:layout_width="match_parent"
251 android:gravity="center_horizontal"
252 android:layout_marginBottom="10dp"
253 android:text="@string/html_format"
254 android:textSize="14sp" />
256 <!-- The bookmarks file location card. -->
257 <androidx.cardview.widget.CardView
258 android:layout_height="wrap_content"
259 android:layout_width="match_parent"
260 android:layout_marginStart="10dp"
261 android:layout_marginEnd="10dp"
262 android:layout_marginBottom="20dp" >
264 <!-- Align the contents of the card vertically. -->
266 android:layout_height="match_parent"
267 android:layout_width="match_parent"
268 android:orientation="vertical"
269 android:layout_marginTop="10dp"
270 android:layout_marginBottom="20dp"
271 android:layout_marginStart="10dp"
272 android:layout_marginEnd="10dp" >
275 android:layout_width="wrap_content"
276 android:layout_height="wrap_content"
277 android:layout_gravity="center_horizontal"
278 android:layout_marginBottom="6dp"
279 android:text="@string/file_location"
280 android:textSize="25sp"
281 android:textStyle="bold"
282 android:textColor="?colorAccent" />
285 android:layout_height="wrap_content"
286 android:layout_width="wrap_content"
287 android:layout_gravity="center_horizontal"
288 android:orientation="horizontal" >
291 android:id="@+id/bookmarks_import_radiobutton"
292 android:layout_height="wrap_content"
293 android:layout_width="wrap_content"
294 android:text="@string/import_button"
295 android:layout_marginEnd="10dp"
296 android:onClick="onClickBookmarksRadioButton" />
299 android:layout_height="wrap_content"
300 android:layout_width="wrap_content"
301 android:text="@string/export"
302 android:onClick="onClickBookmarksRadioButton" />
305 <!-- Align the edit text and the select file button horizontally. -->
307 android:id="@+id/bookmarks_file_name_linearlayout"
308 android:layout_height="wrap_content"
309 android:layout_width="match_parent"
310 android:orientation="horizontal"
311 android:layout_marginTop="10dp">
313 <!-- The text input layout makes the hint float above the edit text. -->
314 <com.google.android.material.textfield.TextInputLayout
315 android:layout_height="wrap_content"
316 android:layout_width="0dp"
317 android:layout_weight="1" >
319 <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
320 <com.google.android.material.textfield.TextInputEditText
321 android:id="@+id/bookmarks_file_name_edittext"
322 android:layout_height="wrap_content"
323 android:layout_width="match_parent"
324 android:hint="@string/file_name"
325 android:inputType="textMultiLine|textUri" />
326 </com.google.android.material.textfield.TextInputLayout>
329 android:id="@+id/bookmarks_browse_button"
330 android:layout_height="wrap_content"
331 android:layout_width="wrap_content"
332 android:layout_gravity="center_vertical"
333 android:text="@string/browse"
334 android:onClick="bookmarksBrowse" />
338 android:id="@+id/bookmarks_import_export_button"
339 android:layout_height="wrap_content"
340 android:layout_width="wrap_content"
341 android:layout_gravity="center_horizontal"
342 android:layout_marginTop="10dp"
343 android:text="@string/import_button"
344 android:textSize="18sp"
345 android:onClick="importExportBookmarks"
346 app:backgroundTint="@color/button_background_selector"
347 android:textColor="@color/button_text_selector" />
349 </androidx.cardview.widget.CardView>
353 <!-- The app bar theme must be specified here because the activity uses a `NoActionBar` theme. -->
354 <com.google.android.material.appbar.AppBarLayout
355 android:id="@+id/import_export_appbarlayout"
356 android:layout_height="wrap_content"
357 android:layout_width="match_parent"
358 android:background="?android:attr/colorBackground"
359 android:theme="@style/PrivacyBrowserAppBar" >
361 <androidx.appcompat.widget.Toolbar
362 android:id="@+id/import_export_toolbar"
363 android:layout_height="wrap_content"
364 android:layout_width="match_parent" />
365 </com.google.android.material.appbar.AppBarLayout>
367 </androidx.coordinatorlayout.widget.CoordinatorLayout>