]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blob - app/src/main/res/layout/view_source_coordinatorlayout.xml
Add swipe to refresh to the View Source activity. https://redmine.stoutner.com/issue...
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / view_source_coordinatorlayout.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2017-2018 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 <android.support.design.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         <android.support.design.widget.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                 <android.support.v7.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.  They make this very difficult to override.  https://redmine.stoutner.com/issues/241
57                 `tools:ignore="UnusedAttribute"` removes the lint warning about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
58                 <ProgressBar
59                     android:id="@+id/progress_bar"
60                     style="?android:attr/progressBarStyleHorizontal"
61                     android:layout_height="wrap_content"
62                     android:layout_width="match_parent"
63                     android:minHeight="3dp"
64                     android:layout_gravity="bottom"
65                     android:progressTint="?attr/progressTintColor"
66                     android:progressBackgroundTint="@color/transparent"
67                     android:visibility="gone"
68                     tools:ignore="UnusedAttribute" />
69             </FrameLayout>
70         </android.support.design.widget.AppBarLayout>
71
72         <android.support.v4.widget.SwipeRefreshLayout
73             android:id="@+id/view_source_swiperefreshlayout"
74             android:layout_height="match_parent"
75             android:layout_width="match_parent">
76
77             <ScrollView
78                 android:layout_height="wrap_content"
79                 android:layout_width="match_parent" >
80
81                 <LinearLayout
82                     android:layout_height="wrap_content"
83                     android:layout_width="match_parent"
84                     android:orientation="vertical"
85                     android:layout_margin="10dp" >
86
87                     <!-- Request headers. -->
88                     <TextView
89                         android:layout_height="wrap_content"
90                         android:layout_width="match_parent"
91                         android:text="@string/request_headers"
92                         android:textAlignment="center"
93                         android:textSize="18sp"
94                         android:textColor="@color/blue_600"
95                         android:textStyle="bold" />
96
97                     <TextView
98                         android:id="@+id/request_headers"
99                         android:layout_height="wrap_content"
100                         android:layout_width="match_parent"
101                         android:textIsSelectable="true"
102                         android:layout_marginBottom="8dp" />
103
104                     <!-- Response message. -->
105                     <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="@color/blue_600"
112                         android:textStyle="bold" />
113
114                     <TextView
115                         android:id="@+id/response_message"
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                     <TextView
123                         android:layout_height="wrap_content"
124                         android:layout_width="match_parent"
125                         android:text="@string/response_headers"
126                         android:textAlignment="center"
127                         android:textSize="18sp"
128                         android:textColor="@color/blue_600"
129                         android:textStyle="bold" />
130
131                     <TextView
132                         android:id="@+id/response_headers"
133                         android:layout_height="wrap_content"
134                         android:layout_width="match_parent"
135                         android:textIsSelectable="true"
136                         android:layout_marginBottom="8dp" />
137
138                     <!-- Response body. -->
139                     <TextView
140                         android:layout_height="wrap_content"
141                         android:layout_width="match_parent"
142                         android:text="@string/response_body"
143                         android:textAlignment="center"
144                         android:textSize="18sp"
145                         android:textColor="@color/blue_600"
146                         android:textStyle="bold" />
147
148                     <TextView
149                         android:id="@+id/response_body"
150                         android:layout_height="wrap_content"
151                         android:layout_width="match_parent"
152                         android:textIsSelectable="true" />
153                 </LinearLayout>
154             </ScrollView>
155         </android.support.v4.widget.SwipeRefreshLayout>
156     </LinearLayout>
157 </android.support.design.widget.CoordinatorLayout>