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