]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blob - app/src/main/res/layout/view_source_coordinatorlayout.xml
Save and restore the app state. https://redmine.stoutner.com/issues/461
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / view_source_coordinatorlayout.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2017-2020 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     tools:context="com.stoutner.privacybrowser.activities.ViewSourceActivity"
27     android:layout_height="match_parent"
28     android:layout_width="match_parent"
29     android:focusable="true"
30     android:focusableInTouchMode="true" >
31
32     <!-- The linear layout with `orientation="vertical"` moves the content below the app bar layout. -->
33     <LinearLayout
34         android:layout_height="match_parent"
35         android:layout_width="match_parent"
36         android:orientation="vertical" >
37
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
43             <!-- The frame layout allows the toolbar and the progress bar to occupy the same space. -->
44             <FrameLayout
45                 android:layout_height="wrap_content"
46                 android:layout_width="match_parent" >
47
48                 <androidx.appcompat.widget.Toolbar
49                     android:id="@+id/view_source_toolbar"
50                     android:layout_height="wrap_content"
51                     android:layout_width="match_parent" />
52
53                 <!-- Android automatically uses a different, skinnier drawable with padding for indeterminate horizontal progress bars in API >= 21.
54                     They make this very difficult to override.  https://redmine.stoutner.com/issues/241
55                     `tools:ignore="UnusedAttribute"` removes the lint warning about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
56                 <ProgressBar
57                     android:id="@+id/progress_bar"
58                     style="?android:attr/progressBarStyleHorizontal"
59                     android:layout_height="wrap_content"
60                     android:layout_width="match_parent"
61                     android:minHeight="3dp"
62                     android:layout_gravity="bottom"
63                     android:visibility="gone"
64                     tools:ignore="UnusedAttribute" />
65             </FrameLayout>
66         </com.google.android.material.appbar.AppBarLayout>
67
68         <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
69             android:id="@+id/view_source_swiperefreshlayout"
70             android:layout_height="match_parent"
71             android:layout_width="match_parent">
72
73             <ScrollView
74                 android:id="@+id/view_source_scrollview"
75                 android:layout_height="wrap_content"
76                 android:layout_width="match_parent" >
77
78                 <LinearLayout
79                     android:layout_height="wrap_content"
80                     android:layout_width="match_parent"
81                     android:orientation="vertical"
82                     android:layout_margin="10dp" >
83
84                     <!-- Request headers. -->
85                     <TextView
86                         android:layout_height="wrap_content"
87                         android:layout_width="match_parent"
88                         android:text="@string/request_headers"
89                         android:textAlignment="center"
90                         android:textSize="18sp"
91                         android:textColor="?attr/blueTextColor"
92                         android:textStyle="bold" />
93
94                     <TextView
95                         android:id="@+id/request_headers"
96                         android:layout_height="wrap_content"
97                         android:layout_width="match_parent"
98                         android:textIsSelectable="true"
99                         android:layout_marginBottom="8dp" />
100
101                     <!-- Response message. -->
102                     <TextView
103                         android:layout_height="wrap_content"
104                         android:layout_width="match_parent"
105                         android:text="@string/response_message"
106                         android:textAlignment="center"
107                         android:textSize="18sp"
108                         android:textColor="?attr/blueTextColor"
109                         android:textStyle="bold" />
110
111                     <TextView
112                         android:id="@+id/response_message"
113                         android:layout_height="wrap_content"
114                         android:layout_width="match_parent"
115                         android:textIsSelectable="true"
116                         android:layout_marginBottom="8dp" />
117
118                     <!-- Response headers. -->
119                     <TextView
120                         android:layout_height="wrap_content"
121                         android:layout_width="match_parent"
122                         android:text="@string/response_headers"
123                         android:textAlignment="center"
124                         android:textSize="18sp"
125                         android:textColor="?attr/blueTextColor"
126                         android:textStyle="bold" />
127
128                     <TextView
129                         android:id="@+id/response_headers"
130                         android:layout_height="wrap_content"
131                         android:layout_width="match_parent"
132                         android:textIsSelectable="true"
133                         android:layout_marginBottom="8dp" />
134
135                     <!-- Response body. -->
136                     <TextView
137                         android:layout_height="wrap_content"
138                         android:layout_width="match_parent"
139                         android:text="@string/response_body"
140                         android:textAlignment="center"
141                         android:textSize="18sp"
142                         android:textColor="?attr/blueTextColor"
143                         android:textStyle="bold" />
144
145                     <TextView
146                         android:id="@+id/response_body"
147                         android:layout_height="wrap_content"
148                         android:layout_width="match_parent"
149                         android:textIsSelectable="true" />
150                 </LinearLayout>
151             </ScrollView>
152         </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
153     </LinearLayout>
154 </androidx.coordinatorlayout.widget.CoordinatorLayout>