Add SSL certificate pinning. Implements https://redmine.stoutner.com/issues/54.
[PrivacyBrowser.git] / app / src / main / res / layout / domain_settings_fragment.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2017 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 <ScrollView
22     android:id="@+id/domain_settings_scrollview"
23     xmlns:android="http://schemas.android.com/apk/res/android"
24     xmlns:tools="http://schemas.android.com/tools"
25     android:layout_height="wrap_content"
26     android:layout_width="match_parent"
27     android:focusable="true"
28     android:focusableInTouchMode="true"
29     android:descendantFocusability="beforeDescendants" >
30
31     <LinearLayout
32         xmlns:android="http://schemas.android.com/apk/res/android"
33         android:layout_height="wrap_content"
34         android:layout_width="match_parent"
35         android:layout_margin="12dp"
36         android:orientation="vertical"
37         android:divider="?android:attr/dividerVertical" >
38
39         <!-- Domain name. -->
40         <LinearLayout
41             android:layout_height="wrap_content"
42             android:layout_width="match_parent"
43             android:orientation="vertical" >
44
45             <LinearLayout
46                 android:layout_height="wrap_content"
47                 android:layout_width="match_parent"
48                 android:orientation="horizontal" >
49
50                 <ImageView
51                     android:layout_height="wrap_content"
52                     android:layout_width="wrap_content"
53                     android:layout_marginEnd="10dp"
54                     android:layout_marginBottom="12dp"
55                     android:layout_gravity="bottom"
56                     android:src="@drawable/domains"
57                     android:tint="?attr/iconTintColor"
58                     tools:ignore="contentDescription" />
59
60                 <!-- `android.support.design.widget.TextInputLayout` makes the `android:hint` float above the `EditText`. -->
61                 <android.support.design.widget.TextInputLayout
62                     android:layout_height="wrap_content"
63                     android:layout_width="match_parent"
64                     android:layout_marginStart="6dp" >
65
66                     <!-- `android:inputType="textUri"` disables spell check in the `EditText`. -->
67                     <android.support.design.widget.TextInputEditText
68                         android:id="@+id/domain_settings_name_edittext"
69                         android:layout_width="match_parent"
70                         android:layout_height="wrap_content"
71                         android:hint="@string/domain_name"
72                         android:inputType="textUri" />
73                 </android.support.design.widget.TextInputLayout>
74             </LinearLayout>
75
76             <TextView
77                 android:layout_height="wrap_content"
78                 android:layout_width="match_parent"
79                 android:text="@string/domain_name_instructions"
80                 android:textSize="12sp"
81                 android:layout_marginStart="43dp"
82                 android:layout_marginBottom="14dp" />
83         </LinearLayout>
84
85         <!-- JavaScript. -->
86         <LinearLayout
87             android:layout_height="wrap_content"
88             android:layout_width="match_parent"
89             android:orientation="horizontal" >
90
91             <ImageView
92                 android:id="@+id/domain_settings_javascript_imageview"
93                 android:layout_height="wrap_content"
94                 android:layout_width="wrap_content"
95                 android:layout_marginTop="1dp"
96                 android:layout_marginEnd="10dp"
97                 android:layout_gravity="center_vertical"
98                 tools:ignore="contentDescription" />
99
100             <Switch
101                 android:id="@+id/domain_settings_javascript_switch"
102                 android:layout_height="wrap_content"
103                 android:layout_width="match_parent"
104                 android:layout_marginStart="8dp"
105                 android:layout_marginTop="14dp"
106                 android:layout_marginBottom="14dp"
107                 android:text="@string/javascript_enabled"
108                 android:textColor="?attr/primaryTextColorSelector"
109                 android:textSize="18sp" />
110         </LinearLayout>
111
112         <!-- First-Party Cookies. -->
113         <LinearLayout
114             android:layout_height="wrap_content"
115             android:layout_width="match_parent"
116             android:orientation="horizontal" >
117
118             <ImageView
119                 android:id="@+id/domain_settings_first_party_cookies_imageview"
120                 android:layout_height="wrap_content"
121                 android:layout_width="wrap_content"
122                 android:layout_marginTop="1dp"
123                 android:layout_marginEnd="10dp"
124                 android:layout_gravity="center_vertical"
125                 tools:ignore="contentDescription" />
126
127             <Switch
128                 android:id="@+id/domain_settings_first_party_cookies_switch"
129                 android:layout_height="wrap_content"
130                 android:layout_width="match_parent"
131                 android:layout_marginStart="8dp"
132                 android:layout_marginTop="14dp"
133                 android:layout_marginBottom="14dp"
134                 android:text="@string/first_party_cookies_enabled"
135                 android:textColor="?attr/primaryTextColorSelector"
136                 android:textSize="18sp" />
137         </LinearLayout>
138
139         <!-- Third-Party Cookies. -->
140         <LinearLayout
141             android:id="@+id/domain_settings_third_party_cookies_linearlayout"
142             android:layout_height="wrap_content"
143             android:layout_width="match_parent"
144             android:orientation="horizontal" >
145
146             <ImageView
147                 android:id="@+id/domain_settings_third_party_cookies_imageview"
148                 android:layout_height="wrap_content"
149                 android:layout_width="wrap_content"
150                 android:layout_marginTop="1dp"
151                 android:layout_marginEnd="10dp"
152                 android:layout_gravity="center_vertical"
153                 tools:ignore="contentDescription" />
154
155             <Switch
156                 android:id="@+id/domain_settings_third_party_cookies_switch"
157                 android:layout_height="wrap_content"
158                 android:layout_width="match_parent"
159                 android:layout_marginStart="8dp"
160                 android:layout_marginTop="14dp"
161                 android:layout_marginBottom="14dp"
162                 android:text="@string/third_party_cookies_enabled"
163                 android:textColor="?attr/primaryTextColorSelector"
164                 android:textSize="18sp" />
165         </LinearLayout>
166
167         <!-- DOM Storage. -->
168         <LinearLayout
169             android:layout_height="wrap_content"
170             android:layout_width="match_parent"
171             android:orientation="horizontal" >
172
173             <ImageView
174                 android:id="@+id/domain_settings_dom_storage_imageview"
175                 android:layout_height="wrap_content"
176                 android:layout_width="wrap_content"
177                 android:layout_marginTop="1dp"
178                 android:layout_marginEnd="10dp"
179                 android:layout_gravity="center_vertical"
180                 tools:ignore="contentDescription" />
181
182             <Switch
183                 android:id="@+id/domain_settings_dom_storage_switch"
184                 android:layout_height="wrap_content"
185                 android:layout_width="match_parent"
186                 android:layout_marginStart="8dp"
187                 android:layout_marginTop="14dp"
188                 android:layout_marginBottom="14dp"
189                 android:text="@string/dom_storage_enabled"
190                 android:textColor="?attr/primaryTextColorSelector"
191                 android:textSize="18sp" />
192         </LinearLayout>
193
194         <!-- Form Data. -->
195         <LinearLayout
196             android:layout_height="wrap_content"
197             android:layout_width="match_parent"
198             android:orientation="horizontal" >
199
200             <ImageView
201                 android:id="@+id/domain_settings_form_data_imageview"
202                 android:layout_height="wrap_content"
203                 android:layout_width="wrap_content"
204                 android:layout_marginTop="1dp"
205                 android:layout_marginEnd="10dp"
206                 android:layout_gravity="center_vertical"
207                 tools:ignore="contentDescription" />
208
209             <Switch
210                 android:id="@+id/domain_settings_form_data_switch"
211                 android:layout_height="wrap_content"
212                 android:layout_width="match_parent"
213                 android:layout_marginStart="8dp"
214                 android:layout_marginTop="14dp"
215                 android:layout_marginBottom="14dp"
216                 android:text="@string/form_data_enabled"
217                 android:textColor="?attr/primaryTextColorSelector"
218                 android:textSize="18sp" />
219         </LinearLayout>
220
221         <!-- User Agent. -->
222         <LinearLayout
223             android:layout_height="wrap_content"
224             android:layout_width="match_parent"
225             android:orientation="vertical"
226             android:layout_marginTop="14dp"
227             android:layout_marginBottom="14dp" >
228
229             <LinearLayout
230                 android:layout_height="wrap_content"
231                 android:layout_width="match_parent"
232                 android:orientation="horizontal" >
233
234                 <ImageView
235                     android:layout_height="wrap_content"
236                     android:layout_width="wrap_content"
237                     android:layout_marginTop="1dp"
238                     android:layout_marginEnd="10dp"
239                     android:layout_gravity="center_vertical"
240                     android:src="@drawable/user_agent_light"
241                     android:tint="?attr/iconTintColor"
242                     android:contentDescription="@string/user_agent" />
243
244                 <Spinner
245                     android:id="@+id/domain_settings_user_agent_spinner"
246                     android:layout_height="wrap_content"
247                     android:layout_width="match_parent"
248                     android:labelFor="@+id/domain_settings_custom_user_agent_edittext" />
249             </LinearLayout>
250
251             <TextView
252                 android:id="@+id/domain_settings_user_agent_textview"
253                 android:layout_height="match_parent"
254                 android:layout_width="match_parent"
255                 android:layout_marginStart="45dp"
256                 android:layout_marginEnd="36dp"
257                 android:textSize="13sp" />
258
259             <EditText
260                 android:id="@id/domain_settings_custom_user_agent_edittext"
261                 android:layout_height="wrap_content"
262                 android:layout_width="match_parent"
263                 android:layout_marginStart="40dp"
264                 android:layout_marginEnd="60dp"
265                 android:inputType="textUri" />
266         </LinearLayout>
267
268         <!-- Font Size. -->
269         <LinearLayout
270             android:layout_height="wrap_content"
271             android:layout_width="match_parent"
272             android:orientation="vertical"
273             android:layout_marginTop="14dp"
274             android:layout_marginBottom="14dp" >
275
276             <LinearLayout
277                 android:layout_height="wrap_content"
278                 android:layout_width="match_parent"
279                 android:orientation="horizontal" >
280
281                 <ImageView
282                     android:layout_height="wrap_content"
283                     android:layout_width="wrap_content"
284                     android:layout_marginTop="1dp"
285                     android:layout_marginEnd="10dp"
286                     android:layout_gravity="center_vertical"
287                     android:src="@drawable/font_size_light"
288                     android:tint="?attr/iconTintColor"
289                     android:contentDescription="@string/font_size" />
290
291                 <Spinner
292                     android:id="@+id/domain_settings_font_size_spinner"
293                     android:layout_height="wrap_content"
294                     android:layout_width="match_parent" />
295             </LinearLayout>
296
297             <TextView
298                 android:id="@+id/domain_settings_font_size_textview"
299                 android:layout_height="match_parent"
300                 android:layout_width="match_parent"
301                 android:layout_marginStart="45dp"
302                 android:layout_marginEnd="36dp"
303                 android:textSize="13sp" />
304
305         </LinearLayout>
306
307         <!-- Display Images. -->
308         <LinearLayout
309             android:layout_height="wrap_content"
310             android:layout_width="match_parent"
311             android:orientation="vertical"
312             android:layout_marginTop="14dp"
313             android:layout_marginBottom="14dp" >
314
315             <LinearLayout
316                 android:layout_height="wrap_content"
317                 android:layout_width="match_parent"
318                 android:orientation="horizontal" >
319
320                 <ImageView
321                     android:id="@+id/domain_settings_display_webpage_images_imageview"
322                     android:layout_height="wrap_content"
323                     android:layout_width="wrap_content"
324                     android:layout_marginTop="1dp"
325                     android:layout_marginEnd="10dp"
326                     android:layout_gravity="center_vertical"
327                     android:contentDescription="@string/display_webpage_images" />
328
329                 <Spinner
330                     android:id="@+id/domain_settings_display_webpage_images_spinner"
331                     android:layout_height="wrap_content"
332                     android:layout_width="match_parent" />
333             </LinearLayout>
334
335             <TextView
336                 android:id="@+id/domain_settings_display_webpage_images_textview"
337                 android:layout_height="match_parent"
338                 android:layout_width="match_parent"
339                 android:layout_marginStart="45dp"
340                 android:layout_marginEnd="36dp"
341                 android:textSize="13sp" />
342         </LinearLayout>
343
344         <!-- Pinned SSL Certificate -->
345         <LinearLayout
346             android:layout_height="wrap_content"
347             android:layout_width="match_parent"
348             android:orientation="vertical"
349             android:layout_marginTop="18dp"
350             android:layout_marginBottom="32dp" >
351
352             <!-- Switch -->
353             <LinearLayout
354                 android:layout_height="wrap_content"
355                 android:layout_width="match_parent"
356                 android:orientation="horizontal" >
357
358                 <ImageView
359                     android:id="@+id/domain_settings_pinned_ssl_certificate_imageview"
360                     android:layout_height="wrap_content"
361                     android:layout_width="wrap_content"
362                     android:layout_marginTop="1dp"
363                     android:layout_marginEnd="10dp"
364                     android:layout_gravity="center_vertical"
365                     tools:ignore="contentDescription" />
366
367                 <Switch
368                     android:id="@+id/domain_settings_pinned_ssl_certificate_switch"
369                     android:layout_height="wrap_content"
370                     android:layout_width="match_parent"
371                     android:layout_marginStart="8dp"
372                     android:text="@string/pinned_ssl_certificate"
373                     android:textColor="?attr/primaryTextColorSelector"
374                     android:textSize="18sp" />
375             </LinearLayout>
376
377             <!-- Saved Certificate -->
378             <LinearLayout
379                 android:id="@+id/saved_ssl_certificate_linearlayout"
380                 android:layout_height="wrap_content"
381                 android:layout_width="match_parent"
382                 android:orientation="vertical"
383                 android:layout_marginTop="20dp"
384                 android:layout_marginBottom="12dp"
385                 android:layout_marginStart="10dp"
386                 android:layout_marginEnd="10dp" >
387
388                 <RadioButton
389                     android:id="@+id/saved_ssl_certificate_radiobutton"
390                     android:layout_height="wrap_content"
391                     android:layout_width="match_parent"
392                     android:text="@string/saved_ssl_certificate"
393                     android:textSize="17sp"
394                     android:textAllCaps="true"
395                     android:textStyle="bold" />
396
397                 <LinearLayout
398                     android:layout_height="wrap_content"
399                     android:layout_width="match_parent"
400                     android:layout_marginStart="32dp"
401                     android:orientation="vertical" >
402
403                     <!-- Saved Certificate Issued To. -->
404                     <TextView
405                         android:layout_height="wrap_content"
406                         android:layout_width="match_parent"
407                         android:text="@string/issued_to"
408                         android:textAllCaps="true"
409                         android:textStyle="bold"
410                         android:textColor="?attr/sslTitle" />
411
412                     <TextView
413                         android:id="@+id/saved_ssl_certificate_issued_to_cname"
414                         android:layout_height="wrap_content"
415                         android:layout_width="match_parent" />
416
417                     <TextView
418                         android:id="@+id/saved_ssl_certificate_issued_to_oname"
419                         android:layout_height="wrap_content"
420                         android:layout_width="match_parent" />
421
422                     <TextView
423                         android:id="@+id/saved_ssl_certificate_issued_to_uname"
424                         android:layout_height="wrap_content"
425                         android:layout_width="match_parent"/>
426
427                     <!-- Saved Certificate Issued By. -->
428                     <TextView
429                         android:layout_height="wrap_content"
430                         android:layout_width="match_parent"
431                         android:layout_marginTop="15dp"
432                         android:text="@string/issued_by"
433                         android:textAllCaps="true"
434                         android:textStyle="bold"
435                         android:textColor="?attr/sslTitle"/>
436
437                     <TextView
438                         android:id="@+id/saved_ssl_certificate_issued_by_cname"
439
440                         android:layout_height="wrap_content"
441                         android:layout_width="match_parent" />
442
443                     <TextView
444                         android:id="@+id/saved_ssl_certificate_issued_by_oname"
445                         android:layout_height="wrap_content"
446                         android:layout_width="match_parent" />
447
448                     <TextView
449                         android:id="@+id/saved_ssl_certificate_issued_by_uname"
450                         android:layout_height="wrap_content"
451                         android:layout_width="match_parent" />
452
453                     <!-- Saved Certificate Valid Dates. -->
454                     <TextView
455                         android:layout_height="wrap_content"
456                         android:layout_width="match_parent"
457                         android:layout_marginTop="15dp"
458                         android:text="@string/valid_dates"
459                         android:textAllCaps="true"
460                         android:textStyle="bold"
461                         android:textColor="?attr/sslTitle"/>
462
463                     <TextView
464                         android:id="@+id/saved_ssl_certificate_start_date"
465                         android:layout_height="wrap_content"
466                         android:layout_width="match_parent" />
467
468                     <TextView
469                         android:id="@+id/saved_ssl_certificate_end_date"
470                         android:layout_height="wrap_content"
471                         android:layout_width="match_parent" />
472                 </LinearLayout>
473             </LinearLayout>
474
475             <!-- Current Website Certificate -->
476             <LinearLayout
477                 android:id="@+id/current_website_certificate_linearlayout"
478                 android:layout_height="wrap_content"
479                 android:layout_width="match_parent"
480                 android:orientation="vertical"
481                 android:layout_marginTop="20dp"
482                 android:layout_marginBottom="8dp"
483                 android:layout_marginStart="10dp"
484                 android:layout_marginEnd="10dp" >
485
486                 <RadioButton
487                     android:id="@+id/current_website_certificate_radiobutton"
488                     android:layout_height="wrap_content"
489                     android:layout_width="match_parent"
490                     android:text="@string/current_website_ssl_certificate"
491                     android:textSize="17sp"
492                     android:textAllCaps="true"
493                     android:textStyle="bold" />
494
495                 <LinearLayout
496                     android:layout_height="wrap_content"
497                     android:layout_width="match_parent"
498                     android:layout_marginStart="32dp"
499                     android:orientation="vertical" >
500
501                     <!-- Current Website Certificate Issued To. -->
502                     <TextView
503                         android:layout_height="wrap_content"
504                         android:layout_width="match_parent"
505                         android:text="@string/issued_to"
506                         android:textAllCaps="true"
507                         android:textStyle="bold"
508                         android:textColor="?attr/sslTitle" />
509
510                     <TextView
511                         android:id="@+id/current_website_certificate_issued_to_cname"
512                         android:layout_height="wrap_content"
513                         android:layout_width="match_parent" />
514
515                     <TextView
516                         android:id="@+id/current_website_certificate_issued_to_oname"
517                         android:layout_height="wrap_content"
518                         android:layout_width="match_parent" />
519
520                     <TextView
521                         android:id="@+id/current_website_certificate_issued_to_uname"
522                         android:layout_height="wrap_content"
523                         android:layout_width="match_parent" />
524
525                     <!-- Current Website Certificate Issued By. -->
526                     <TextView
527                         android:layout_height="wrap_content"
528                         android:layout_width="match_parent"
529                         android:layout_marginTop="15dp"
530                         android:text="@string/issued_by"
531                         android:textAllCaps="true"
532                         android:textStyle="bold"
533                         android:textColor="?attr/sslTitle" />
534
535                     <TextView
536                         android:id="@+id/current_website_certificate_issued_by_cname"
537                         android:layout_height="wrap_content"
538                         android:layout_width="match_parent" />
539
540                     <TextView
541                         android:id="@+id/current_website_certificate_issued_by_oname"
542                         android:layout_height="wrap_content"
543                         android:layout_width="match_parent" />
544
545                     <TextView
546                         android:id="@+id/current_website_certificate_issued_by_uname"
547                         android:layout_height="wrap_content"
548                         android:layout_width="match_parent" />
549
550                     <!-- Current Website Certificate Valid Dates. -->
551                     <TextView
552                         android:layout_height="wrap_content"
553                         android:layout_width="match_parent"
554                         android:layout_marginTop="15dp"
555                         android:text="@string/valid_dates"
556                         android:textAllCaps="true"
557                         android:textStyle="bold"
558                         android:textColor="?attr/sslTitle" />
559
560                     <TextView
561                         android:id="@+id/current_website_certificate_start_date"
562                         android:layout_height="wrap_content"
563                         android:layout_width="match_parent" />
564
565                     <TextView
566                         android:id="@+id/current_website_certificate_end_date"
567                         android:layout_height="wrap_content"
568                         android:layout_width="match_parent" />
569                 </LinearLayout>
570             </LinearLayout>
571
572             <!-- Load An Encrypted Website Instructions. -->
573             <TextView
574                 android:id="@+id/no_current_website_certificate"
575                 android:layout_height="wrap_content"
576                 android:layout_width="match_parent"
577                 android:layout_marginTop="10dp"
578                 android:layout_marginStart="40dp"
579                 android:layout_marginEnd="40dp"
580                 android:gravity="center_horizontal"
581                 android:text="@string/load_an_encrypted_website" />
582         </LinearLayout>
583     </LinearLayout>
584 </ScrollView>