]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blob - app/src/main/res/layout/view_headers_bottom_appbar.xml
Add a flow layout to the Headers SSL buttons.
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / view_headers_bottom_appbar.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright 2017-2023 Soren Stoutner <soren@stoutner.com>.
5
6   This file is part of Privacy Browser Android <https://www.stoutner.com/privacy-browser-android>.
7
8   Privacy Browser Android 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 Android 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 Android.  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/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     xmlns:app="http://schemas.android.com/apk/res-auto">
31
32     <!-- 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. -->
33     <LinearLayout
34         android:layout_height="match_parent"
35         android:layout_width="match_parent"
36         android:orientation="vertical"
37         app:layout_dodgeInsetEdges="bottom" >
38
39         <!-- `android:layout_weight="1"` causes the swipe refresh layout to fill all the remaining space. -->
40         <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
41             android:id="@+id/swiperefreshlayout"
42             android:layout_height="0dp"
43             android:layout_width="match_parent"
44             android:layout_weight="1">
45
46             <ScrollView
47                 android:id="@+id/scrollview"
48                 android:layout_height="wrap_content"
49                 android:layout_width="match_parent" >
50
51                 <LinearLayout
52                     android:layout_height="wrap_content"
53                     android:layout_width="match_parent"
54                     android:orientation="vertical"
55                     android:layout_margin="10dp" >
56
57                     <!-- SSL information. -->
58                     <TextView
59                         android:id="@+id/ssl_information_title_textview"
60                         android:layout_height="wrap_content"
61                         android:layout_width="match_parent"
62                         android:text="@string/ssl_information"
63                         android:textAlignment="center"
64                         android:textSize="18sp"
65                         android:textColor="@color/blue_text"
66                         android:textStyle="bold" />
67
68                     <TextView
69                         android:id="@+id/ssl_information_textview"
70                         android:layout_height="wrap_content"
71                         android:layout_width="match_parent"
72                         android:textIsSelectable="true"
73                         android:layout_marginBottom="8dp" />
74
75                     <!-- SSL Buttons. -->
76                     <androidx.constraintlayout.widget.ConstraintLayout
77                         android:id="@+id/ssl_buttons_constraintlayout"
78                         android:layout_height="wrap_content"
79                         android:layout_width="match_parent"
80                         android:layout_marginBottom="16dp"
81                         tools:ignore="MissingConstraints" >
82
83                         <androidx.constraintlayout.helper.widget.Flow
84                             android:layout_height="wrap_content"
85                             android:layout_width="match_parent"
86                             app:constraint_referenced_ids="ciphers_button,certificate_button"
87                             app:flow_wrapMode="chain"
88                             app:flow_firstHorizontalStyle="packed"
89                             app:flow_horizontalGap="15dp" />
90
91                         <androidx.appcompat.widget.AppCompatButton
92                             android:id="@+id/ciphers_button"
93                             android:layout_height="wrap_content"
94                             android:layout_width="wrap_content"
95                             android:text="@string/ciphers"
96                             android:onClick="showCiphers"
97                             app:backgroundTint="@color/button_background_selector"
98                             android:textColor="@color/button_text_selector"
99                             tools:ignore="ButtonStyle" />
100
101                         <androidx.appcompat.widget.AppCompatButton
102                             android:id="@+id/certificate_button"
103                             android:layout_height="wrap_content"
104                             android:layout_width="wrap_content"
105                             android:text="@string/certificate"
106                             android:onClick="showCertificate"
107                             app:backgroundTint="@color/button_background_selector"
108                             android:textColor="@color/button_text_selector"
109                             tools:ignore="ButtonStyle" />
110                     </androidx.constraintlayout.widget.ConstraintLayout>
111
112                     <!-- Request headers. -->
113                     <TextView
114                         android:id="@+id/request_headers_title_textview"
115                         android:layout_height="wrap_content"
116                         android:layout_width="match_parent"
117                         android:text="@string/request_headers"
118                         android:textAlignment="center"
119                         android:textSize="18sp"
120                         android:textColor="@color/blue_text"
121                         android:textStyle="bold" />
122
123                     <TextView
124                         android:id="@+id/request_headers_textview"
125                         android:layout_height="wrap_content"
126                         android:layout_width="match_parent"
127                         android:textIsSelectable="true"
128                         android:layout_marginBottom="8dp" />
129
130                     <!-- Response message. -->
131                     <TextView
132                         android:id="@+id/response_message_title_textview"
133                         android:layout_height="wrap_content"
134                         android:layout_width="match_parent"
135                         android:text="@string/response_message"
136                         android:textAlignment="center"
137                         android:textSize="18sp"
138                         android:textColor="@color/blue_text"
139                         android:textStyle="bold" />
140
141                     <TextView
142                         android:id="@+id/response_message_textview"
143                         android:layout_height="wrap_content"
144                         android:layout_width="match_parent"
145                         android:textIsSelectable="true"
146                         android:layout_marginBottom="8dp" />
147
148                     <!-- Response headers. -->
149                     <!-- The title text is set programatically. -->
150                     <TextView
151                         android:id="@+id/response_headers_title_textview"
152                         android:layout_height="wrap_content"
153                         android:layout_width="match_parent"
154                         android:textAlignment="center"
155                         android:textSize="18sp"
156                         android:textColor="@color/blue_text"
157                         android:textStyle="bold" />
158
159                     <TextView
160                         android:id="@+id/response_headers_textview"
161                         android:layout_height="wrap_content"
162                         android:layout_width="match_parent"
163                         android:textIsSelectable="true"
164                         android:layout_marginBottom="8dp" />
165
166                     <!-- Response body. -->
167                     <!-- The title text is set programatically. -->
168                     <TextView
169                         android:id="@+id/response_body_title_textview"
170                         android:layout_height="wrap_content"
171                         android:layout_width="match_parent"
172                         android:textAlignment="center"
173                         android:textSize="18sp"
174                         android:textColor="@color/blue_text"
175                         android:textStyle="bold" />
176
177                     <TextView
178                         android:id="@+id/response_body_textview"
179                         android:layout_height="wrap_content"
180                         android:layout_width="match_parent"
181                         android:textIsSelectable="true" />
182                 </LinearLayout>
183             </ScrollView>
184         </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
185
186         <!-- The app bar theme must be specified here because the activity uses a `NoActionBar` theme. -->
187         <com.google.android.material.appbar.AppBarLayout
188             android:layout_height="wrap_content"
189             android:layout_width="match_parent"
190             android:background="?android:attr/colorBackground"
191             android:theme="@style/PrivacyBrowserAppBar" >
192
193             <!-- The frame layout allows the toolbar and the progress bar to occupy the same space. -->
194             <FrameLayout
195                 android:layout_height="wrap_content"
196                 android:layout_width="match_parent" >
197
198                 <androidx.appcompat.widget.Toolbar
199                     android:id="@+id/toolbar"
200                     android:layout_height="wrap_content"
201                     android:layout_width="match_parent" />
202
203                 <!-- Android automatically uses a different, skinnier drawable with padding for indeterminate horizontal progress bars in API >= 21.
204                     They make this very difficult to override.  https://redmine.stoutner.com/issues/241
205                     `tools:ignore="UnusedAttribute"` removes the lint warning about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
206                 <ProgressBar
207                     android:id="@+id/progress_bar"
208                     style="?android:attr/progressBarStyleHorizontal"
209                     android:layout_height="wrap_content"
210                     android:layout_width="match_parent"
211                     android:minHeight="3dp"
212                     android:layout_gravity="bottom"
213                     android:visibility="gone"
214                     tools:ignore="UnusedAttribute" />
215             </FrameLayout>
216         </com.google.android.material.appbar.AppBarLayout>
217     </LinearLayout>
218 </androidx.coordinatorlayout.widget.CoordinatorLayout>