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