2f295dfb0c8648499d2ff30e558def1e9a7f6915
[PrivacyBrowser.git] / app / src / main / res / layout / main_framelayout_bottom_appbar.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2015-2017,2019-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 <FrameLayout
22     android:id="@+id/root_framelayout"
23     xmlns:android="http://schemas.android.com/apk/res/android"
24     xmlns:app="http://schemas.android.com/apk/res-auto"
25     xmlns:tools="http://schemas.android.com/tools"
26     android:layout_height="match_parent"
27     android:layout_width="match_parent" >
28
29     <androidx.drawerlayout.widget.DrawerLayout
30         android:id="@+id/drawerlayout"
31         android:layout_height="match_parent"
32         android:layout_width="match_parent" >
33
34         <!-- The relative layout contains the AdView and the coordinator layout, which contains the rest of the views. -->
35         <RelativeLayout
36             android:id="@+id/main_content_relativelayout"
37             android:layout_height="match_parent"
38             android:layout_width="match_parent" >
39
40             <!-- Include the AdView.  For the standard flavor, this just includes a TextView with `visibility="gone"`. -->
41             <include layout="@layout/adview_bottom_appbar" />
42
43             <!-- Setting the CoordinatorLayout to be `focusableInTouchMode` prevents the URL text box from stealing focus on launch and opening the keyboard. -->
44             <androidx.coordinatorlayout.widget.CoordinatorLayout
45                 android:layout_height="match_parent"
46                 android:layout_width="match_parent"
47                 android:layout_below="@id/adview"
48                 android:focusable="true"
49                 android:focusableInTouchMode="true" >
50
51                     <!-- `app:layout_dodgeInsetEdges="bottom"` as a child of a coordinator layout moves the view above snackbars. -->
52                     <RelativeLayout
53                         android:layout_height="match_parent"
54                         android:layout_width="match_parent"
55                         app:layout_dodgeInsetEdges="bottom" >
56
57                         <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
58                             android:id="@+id/swiperefreshlayout"
59                             android:layout_width="match_parent"
60                             android:layout_height="match_parent"
61                             android:layout_above="@id/appbar_layout" >
62
63                             <com.stoutner.privacybrowser.views.NoSwipeViewPager
64                                 android:id="@+id/webviewpager"
65                                 android:layout_height="match_parent"
66                                 android:layout_width="match_parent" />
67                         </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
68
69                         <!-- The app bar theme must be specified here because the activity uses a `NoActionBar` theme.  The background is set programmatically based on the proxy status. -->
70                         <com.google.android.material.appbar.AppBarLayout
71                             android:id="@+id/appbar_layout"
72                             android:layout_height="wrap_content"
73                             android:layout_width="match_parent"
74                             android:theme="@style/PrivacyBrowserAppBar"
75                             android:layout_alignParentBottom="true" >
76
77                             <!-- The tab linear layout.  It sets the background to the right of the add tab button.
78                                 It is initially `visibility="gone"` so it doesn't display while the blocklists are loading. -->
79                             <LinearLayout
80                                 android:id="@+id/tabs_linearlayout"
81                                 android:layout_height="wrap_content"
82                                 android:layout_width="wrap_content"
83                                 android:orientation="horizontal"
84                                 android:visibility="gone" >
85
86                                 <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
87                                 <ImageView
88                                     android:layout_height="match_parent"
89                                     android:layout_width="wrap_content"
90                                     android:layout_gravity="center_vertical"
91                                     android:paddingStart="10dp"
92                                     android:paddingEnd="10dp"
93                                     android:src="@drawable/close_day"
94                                     android:background="?attr/selectableItemBackground"
95                                     android:onClick="closeTab"
96                                     android:contentDescription="@string/close_tab"
97                                     app:tint="?attr/addTabIconTintColor" />
98
99                                 <com.google.android.material.tabs.TabLayout
100                                     android:id="@+id/tablayout"
101                                     android:layout_height="wrap_content"
102                                     android:layout_width="0dp"
103                                     android:layout_weight="1"
104                                     app:tabMode="scrollable" />
105
106                                 <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
107                                 <ImageView
108                                     android:layout_height="match_parent"
109                                     android:layout_width="wrap_content"
110                                     android:layout_gravity="center_vertical"
111                                     android:paddingStart="10dp"
112                                     android:paddingEnd="10dp"
113                                     android:src="@drawable/add"
114                                     android:background="?attr/selectableItemBackground"
115                                     android:onClick="addTab"
116                                     android:contentDescription="@string/add_tab"
117                                     app:tint="?attr/addTabIconTintColor" />
118                             </LinearLayout>
119
120                             <!-- The find on page linear layout.  It is initially `visibility="gone"` so it doesn't display while the blocklists are loading. -->
121                             <LinearLayout
122                                 android:id="@+id/find_on_page_linearlayout"
123                                 android:layout_height="wrap_content"
124                                 android:layout_width="match_parent"
125                                 android:orientation="horizontal"
126                                 android:visibility="gone" >
127
128                                 <!-- `android:imeOptions="actionDone"` sets the keyboard to have a `check mark` key instead of a `new line` key. -->
129                                 <EditText
130                                     android:id="@+id/find_on_page_edittext"
131                                     android:layout_height="wrap_content"
132                                     android:layout_width="0dp"
133                                     android:layout_weight="1"
134                                     android:layout_marginStart="8dp"
135                                     android:layout_marginEnd="4dp"
136                                     android:hint="@string/find_on_page"
137                                     android:lines="1"
138                                     android:imeOptions="actionDone"
139                                     android:inputType="text"
140                                     tools:ignore="Autofill" />
141
142                                 <TextView
143                                     android:id="@+id/find_on_page_count_textview"
144                                     android:layout_height="wrap_content"
145                                     android:layout_width="wrap_content"
146                                     android:layout_marginStart="4dp"
147                                     android:layout_marginEnd="4dp"
148                                     android:text="@string/zero_of_zero" />
149
150                                 <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
151                                 <ImageView
152                                     android:id="@+id/find_previous"
153                                     android:src="@drawable/previous"
154                                     android:layout_width="35dp"
155                                     android:layout_height="35dp"
156                                     android:layout_marginStart="4dp"
157                                     android:layout_marginEnd="4dp"
158                                     android:layout_gravity="center_vertical"
159                                     android:background="?attr/selectableItemBackground"
160                                     android:contentDescription="@string/previous"
161                                     android:onClick="findPreviousOnPage"
162                                     app:tint="?attr/findOnPageIconTintColor" />
163
164                                 <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
165                                 <ImageView
166                                     android:id="@+id/find_next"
167                                     android:src="@drawable/next"
168                                     android:layout_width="35dp"
169                                     android:layout_height="35dp"
170                                     android:layout_marginStart="4dp"
171                                     android:layout_marginEnd="4dp"
172                                     android:layout_gravity="center_vertical"
173                                     android:background="?attr/selectableItemBackground"
174                                     android:contentDescription="@string/next"
175                                     android:onClick="findNextOnPage"
176                                     app:tint="?attr/findOnPageIconTintColor" />
177
178                                 <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
179                                 <ImageView
180                                     android:id="@+id/close_find"
181                                     android:src="@drawable/close_day"
182                                     android:layout_width="35dp"
183                                     android:layout_height="35dp"
184                                     android:layout_marginStart="4dp"
185                                     android:layout_marginEnd="8dp"
186                                     android:layout_gravity="center_vertical"
187                                     android:background="?attr/selectableItemBackground"
188                                     android:contentDescription="@string/close"
189                                     android:onClick="closeFindOnPage"
190                                     app:tint="?attr/findOnPageIconTintColor" />
191                             </LinearLayout>
192
193                             <!-- The toolbar.  It is initially `visibility="gone"` so it doesn't display while the blocklists are loading. -->
194                             <androidx.appcompat.widget.Toolbar
195                                 android:id="@+id/toolbar"
196                                 android:layout_height="wrap_content"
197                                 android:layout_width="match_parent"
198                                 android:visibility="gone" />
199                         </com.google.android.material.appbar.AppBarLayout>
200                     </RelativeLayout>
201             </androidx.coordinatorlayout.widget.CoordinatorLayout>
202         </RelativeLayout>
203
204         <!-- The navigation drawer. -->
205         <com.google.android.material.navigation.NavigationView
206             android:id="@+id/navigationview"
207             android:layout_height="match_parent"
208             android:layout_width="wrap_content"
209             android:layout_gravity="start"
210             app:menu="@menu/webview_navigation_menu"
211             app:itemIconTint="?attr/navigationIconTintColor" />
212
213         <!-- Include the bookmarks drawer, which varies based on screen width. -->
214         <include layout="@layout/bookmarks_drawer_bottom_appbar" />
215     </androidx.drawerlayout.widget.DrawerLayout>
216
217     <!-- The full screen video frame layout is used to display full screen videos.  It is initially `android:visibility="gone"` to hide it from view. -->
218     <FrameLayout
219         android:id="@+id/full_screen_video_framelayout"
220         android:layout_height="match_parent"
221         android:layout_width="match_parent"
222         android:visibility="gone" />
223
224     <!-- The loading blocklists relative layout displays when the app first starts.  It is hidden once the blocklists are populated. -->
225     <RelativeLayout
226         android:id="@+id/loading_blocklists_relativelayout"
227         android:layout_width="match_parent"
228         android:layout_height="match_parent">
229
230         <ImageView
231             android:id="@+id/privacy_browser_logo"
232             android:layout_height="256dp"
233             android:layout_width="256dp"
234             android:layout_centerInParent="true"
235             android:src="@drawable/privacy_browser_foreground"
236             tools:ignore="contentDescription" />
237
238         <TextView
239             android:id="@+id/loading_blocklist_textview"
240             android:layout_width="wrap_content"
241             android:layout_height="wrap_content"
242             android:layout_below="@id/privacy_browser_logo"
243             android:layout_centerHorizontal="true"
244             android:layout_margin="10dp"
245             android:textSize="16sp"
246             android:textAlignment="center"
247             android:textColor="?android:attr/textColorPrimary" />
248     </RelativeLayout>
249 </FrameLayout>