1 <?xml version="1.0" encoding="utf-8"?>
4 Copyright © 2018-2020 Soren Stoutner <soren@stoutner.com>.
6 This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
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.
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.
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/>. -->
21 <androidx.coordinatorlayout.widget.CoordinatorLayout
22 android:id="@+id/import_export_coordinatorlayout"
23 xmlns:android="http://schemas.android.com/apk/res/android"
24 xmlns:app="http://schemas.android.com/apk/res-auto"
25 android:layout_height="match_parent"
26 android:layout_width="match_parent" >
28 <!-- the linear layout with `orientation="vertical"` moves the content below the app bar layout. -->
30 android:layout_height="match_parent"
31 android:layout_width="match_parent"
32 android:orientation="vertical" >
34 <!-- The app bar theme must be specified here because the activity uses a `NoActionBar` theme. -->
35 <com.google.android.material.appbar.AppBarLayout
36 android:id="@+id/import_export_appbarlayout"
37 android:layout_height="wrap_content"
38 android:layout_width="match_parent"
39 android:background="?android:attr/colorBackground"
40 android:theme="@style/PrivacyBrowserAppBar" >
42 <androidx.appcompat.widget.Toolbar
43 android:id="@+id/import_export_toolbar"
44 android:layout_height="wrap_content"
45 android:layout_width="match_parent" />
46 </com.google.android.material.appbar.AppBarLayout>
49 android:layout_height="match_parent"
50 android:layout_width="match_parent" >
52 <!-- Align the cards vertically. -->
54 android:layout_height="wrap_content"
55 android:layout_width="match_parent"
56 android:orientation="vertical" >
58 <!-- The encryption card. -->
59 <androidx.cardview.widget.CardView
60 android:layout_height="wrap_content"
61 android:layout_width="match_parent"
62 android:layout_marginTop="10dp"
63 android:layout_marginBottom="5dp"
64 android:layout_marginStart="10dp"
65 android:layout_marginEnd="10dp" >
67 <!-- Align the contents of the card vertically. -->
69 android:layout_height="match_parent"
70 android:layout_width="match_parent"
71 android:orientation="vertical"
72 android:layout_marginTop="10dp"
73 android:layout_marginBottom="20dp"
74 android:layout_marginStart="10dp"
75 android:layout_marginEnd="10dp" >
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/encryption"
83 android:textSize="25sp"
84 android:textStyle="bold"
85 android:textColor="?colorAccent" />
88 android:id="@+id/encryption_spinner"
89 android:layout_height="wrap_content"
90 android:layout_width="wrap_content"
91 android:layout_gravity="center_horizontal" />
93 <!-- The encryption password. -->
94 <com.google.android.material.textfield.TextInputLayout
95 android:id="@+id/password_encryption_textinputlayout"
96 android:layout_height="wrap_content"
97 android:layout_width="match_parent"
98 app:passwordToggleEnabled="true" >
100 <com.google.android.material.textfield.TextInputEditText
101 android:id="@+id/password_encryption_edittext"
102 android:layout_height="wrap_content"
103 android:layout_width="match_parent"
104 android:hint="@string/password"
105 android:inputType="textPassword"/>
106 </com.google.android.material.textfield.TextInputLayout>
108 <!-- KitKat password encryption message. -->
110 android:id="@+id/kitkat_password_encryption_textview"
111 android:layout_height="wrap_content"
112 android:layout_width="wrap_content"
113 android:layout_gravity="center_horizontal"
114 android:layout_marginTop="10dp"
115 android:text="@string/kitkat_password_encryption_message"
116 android:textAlignment="center" />
118 <!-- OpenKeychain required message. -->
120 android:id="@+id/openkeychain_required_textview"
121 android:layout_height="wrap_content"
122 android:layout_width="wrap_content"
123 android:layout_gravity="center_horizontal"
124 android:layout_marginTop="10dp"
125 android:text="@string/openkeychain_required"
126 android:textAlignment="center" />
128 </androidx.cardview.widget.CardView>
130 <!-- The file location card. -->
131 <androidx.cardview.widget.CardView
132 android:id="@+id/file_location_cardview"
133 android:layout_height="wrap_content"
134 android:layout_width="match_parent"
135 android:layout_marginTop="5dp"
136 android:layout_marginBottom="5dp"
137 android:layout_marginStart="10dp"
138 android:layout_marginEnd="10dp" >
140 <!-- Align the contents of the card vertically. -->
142 android:layout_height="match_parent"
143 android:layout_width="match_parent"
144 android:orientation="vertical"
145 android:layout_marginTop="10dp"
146 android:layout_marginBottom="20dp"
147 android:layout_marginStart="10dp"
148 android:layout_marginEnd="10dp" >
151 android:layout_width="wrap_content"
152 android:layout_height="wrap_content"
153 android:layout_gravity="center_horizontal"
154 android:layout_marginBottom="6dp"
155 android:text="@string/file_location"
156 android:textSize="25sp"
157 android:textStyle="bold"
158 android:textColor="?colorAccent" />
161 android:layout_height="wrap_content"
162 android:layout_width="wrap_content"
163 android:layout_gravity="center_horizontal"
164 android:orientation="horizontal" >
167 android:id="@+id/import_radiobutton"
168 android:layout_height="wrap_content"
169 android:layout_width="wrap_content"
170 android:text="@string/import_button"
171 android:layout_marginEnd="10dp"
172 android:onClick="onClickRadioButton" />
175 android:id="@+id/export_radiobutton"
176 android:layout_height="wrap_content"
177 android:layout_width="wrap_content"
178 android:text="@string/export"
179 android:onClick="onClickRadioButton" />
182 <!-- Align the edit text and the select file button horizontally. -->
184 android:id="@+id/file_name_linearlayout"
185 android:layout_height="wrap_content"
186 android:layout_width="match_parent"
187 android:orientation="horizontal"
188 android:layout_marginTop="10dp">
190 <!-- The text input layout makes the hint float above the edit text. -->
191 <com.google.android.material.textfield.TextInputLayout
192 android:layout_height="wrap_content"
193 android:layout_width="0dp"
194 android:layout_weight="1" >
196 <!-- `android:inputType="textUri" disables spell check and places an `/` on the main keyboard. -->
197 <com.google.android.material.textfield.TextInputEditText
198 android:id="@+id/file_name_edittext"
199 android:layout_height="wrap_content"
200 android:layout_width="match_parent"
201 android:hint="@string/file_name"
202 android:inputType="textMultiLine|textUri" />
203 </com.google.android.material.textfield.TextInputLayout>
206 android:id="@+id/browse_button"
207 android:layout_height="wrap_content"
208 android:layout_width="wrap_content"
209 android:layout_gravity="center_vertical"
210 android:text="@string/browse"
211 android:onClick="browse" />
214 <!-- File notices. -->
216 android:id="@+id/file_does_not_exist_textview"
217 android:layout_height="wrap_content"
218 android:layout_width="wrap_content"
219 android:layout_gravity="center_horizontal"
220 android:layout_margin="5dp"
221 android:text="@string/file_does_not_exist"
222 android:textColor="?attr/redTextColor"
223 android:textAlignment="center" />
226 android:id="@+id/file_exists_warning_textview"
227 android:layout_height="wrap_content"
228 android:layout_width="wrap_content"
229 android:layout_gravity="center_horizontal"
230 android:layout_margin="5dp"
231 android:text="@string/file_exists_warning"
232 android:textColor="?attr/redTextColor"
233 android:textAlignment="center" />
235 <!-- OpenKeychain import instructions -->
237 android:id="@+id/openkeychain_import_instructions_textview"
238 android:layout_height="wrap_content"
239 android:layout_width="wrap_content"
240 android:layout_gravity="center_horizontal"
241 android:layout_margin="5dp"
242 android:text="@string/openkeychain_import_instructions"
243 android:textAlignment="center" />
246 android:id="@+id/import_export_button"
247 android:layout_height="wrap_content"
248 android:layout_width="wrap_content"
249 android:layout_gravity="center_horizontal"
250 android:layout_marginTop="10dp"
251 android:text="@string/import_button"
252 android:textSize="18sp"
253 android:onClick="importExport"
254 app:backgroundTint="?attr/buttonBackgroundColorSelector"
255 android:textColor="?attr/buttonTextColorSelector" />
257 </androidx.cardview.widget.CardView>
260 android:id="@+id/import_export_storage_permission_textview"
261 android:layout_width="wrap_content"
262 android:layout_height="wrap_content"
263 android:layout_gravity="center_horizontal"
264 android:layout_marginBottom="10dp"
265 android:layout_marginStart="15dp"
266 android:layout_marginEnd="15dp"
267 android:text="@string/storage_permission_explanation"
268 android:textAlignment="center" />
272 </androidx.coordinatorlayout.widget.CoordinatorLayout>