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