Handle content:// URLs in View Source. https://redmine.stoutner.com/issues/361
[PrivacyBrowser.git] / app / src / main / res / layout / view_source_coordinatorlayout.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2017-2021 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 <!-- Setting the layout root to be `focusableInTouchMode` prevents the URL toolbar from stealing focus on launch and opening the keyboard. -->
22 <androidx.coordinatorlayout.widget.CoordinatorLayout
23     android:id="@+id/view_source_coordinatorlayout"
24     xmlns:android="http://schemas.android.com/apk/res/android"
25     xmlns:tools="http://schemas.android.com/tools"
26     android:layout_height="match_parent"
27     android:layout_width="match_parent"
28     android:focusable="true"
29     android:focusableInTouchMode="true" >
30
31     <!-- The linear layout with `orientation="vertical"` moves the content below the app bar layout. -->
32     <LinearLayout
33         android:layout_height="match_parent"
34         android:layout_width="match_parent"
35         android:orientation="vertical" >
36
37         <!-- The app bar theme must be specified here because the activity uses a `NoActionBar` theme. -->
38         <com.google.android.material.appbar.AppBarLayout
39             android:layout_height="wrap_content"
40             android:layout_width="match_parent"
41             android:background="?android:attr/colorBackground"
42             android:theme="@style/PrivacyBrowserAppBar" >
43
44             <!-- The frame layout allows the toolbar and the progress bar to occupy the same space. -->
45             <FrameLayout
46                 android:layout_height="wrap_content"
47                 android:layout_width="match_parent" >
48
49                 <androidx.appcompat.widget.Toolbar
50                     android:id="@+id/view_source_toolbar"
51                     android:layout_height="wrap_content"
52                     android:layout_width="match_parent" />
53
54                 <!-- Android automatically uses a different, skinnier drawable with padding for indeterminate horizontal progress bars in API >= 21.
55                     They make this very difficult to override.  https://redmine.stoutner.com/issues/241
56                     `tools:ignore="UnusedAttribute"` removes the lint warning about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
57                 <ProgressBar
58                     android:id="@+id/progress_bar"
59                     style="?android:attr/progressBarStyleHorizontal"
60                     android:layout_height="wrap_content"
61                     android:layout_width="match_parent"
62                     android:minHeight="3dp"
63                     android:layout_gravity="bottom"
64                     android:visibility="gone"
65                     tools:ignore="UnusedAttribute" />
66             </FrameLayout>
67         </com.google.android.material.appbar.AppBarLayout>
68
69         <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
70             android:id="@+id/view_source_swiperefreshlayout"
71             android:layout_height="match_parent"
72             android:layout_width="match_parent">
73
74             <ScrollView
75                 android:id="@+id/view_source_scrollview"
76                 android:layout_height="wrap_content"
77                 android:layout_width="match_parent" >
78
79                 <LinearLayout
80                     android:layout_height="wrap_content"
81                     android:layout_width="match_parent"
82                     android:orientation="vertical"
83                     android:layout_margin="10dp" >
84
85                     <!-- Request headers. -->
86                     <TextView
87                         android:id="@+id/request_headers_title_textview"
88                         android:layout_height="wrap_content"
89                         android:layout_width="match_parent"
90                         android:text="@string/request_headers"
91                         android:textAlignment="center"
92                         android:textSize="18sp"
93                         android:textColor="?attr/blueTextColor"
94                         android:textStyle="bold" />
95
96                     <TextView
97                         android:id="@+id/request_headers_textview"
98                         android:layout_height="wrap_content"
99                         android:layout_width="match_parent"
100                         android:textIsSelectable="true"
101                         android:layout_marginBottom="8dp" />
102
103                     <!-- Response message. -->
104                     <TextView
105                         android:id="@+id/response_message_title_textview"
106                         android:layout_height="wrap_content"
107                         android:layout_width="match_parent"
108                         android:text="@string/response_message"
109                         android:textAlignment="center"
110                         android:textSize="18sp"
111                         android:textColor="?attr/blueTextColor"
112                         android:textStyle="bold" />
113
114                     <TextView
115                         android:id="@+id/response_message_textview"
116                         android:layout_height="wrap_content"
117                         android:layout_width="match_parent"
118                         android:textIsSelectable="true"
119                         android:layout_marginBottom="8dp" />
120
121                     <!-- Response headers. -->
122                     <!-- The title text is set programatically. -->
123                     <TextView
124                         android:id="@+id/response_headers_title_textivew"
125                         android:layout_height="wrap_content"
126                         android:layout_width="match_parent"
127                         android:textAlignment="center"
128                         android:textSize="18sp"
129                         android:textColor="?attr/blueTextColor"
130                         android:textStyle="bold" />
131
132                     <TextView
133                         android:id="@+id/response_headers_textview"
134                         android:layout_height="wrap_content"
135                         android:layout_width="match_parent"
136                         android:textIsSelectable="true"
137                         android:layout_marginBottom="8dp" />
138
139                     <!-- Response body. -->
140                     <!-- The title text is set programatically. -->
141                     <TextView
142                         android:id="@+id/response_body_title_textview"
143                         android:layout_height="wrap_content"
144                         android:layout_width="match_parent"
145                         android:textAlignment="center"
146                         android:textSize="18sp"
147                         android:textColor="?attr/blueTextColor"
148                         android:textStyle="bold" />
149
150                     <TextView
151                         android:id="@+id/response_body_textview"
152                         android:layout_height="wrap_content"
153                         android:layout_width="match_parent"
154                         android:textIsSelectable="true" />
155                 </LinearLayout>
156             </ScrollView>
157         </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
158     </LinearLayout>
159 </androidx.coordinatorlayout.widget.CoordinatorLayout>