Create a blocklists loading splash screen. https://redmine.stoutner.com/issues/285
[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 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             `android:fitsSystemWindows="true"` moves the toolbar below the system status bar but lets the drawers slide under the translucent status bar.
36             When it is specified, the theme should include `<item name="android:windowTranslucentStatus">true</item>`. -->
37         <RelativeLayout
38             android:id="@+id/main_content_relativelayout"
39             android:layout_height="match_parent"
40             android:layout_width="match_parent"
41             android:fitsSystemWindows="true" >
42
43             <!-- Include the AdView.  For the standard flavor, this just includes a TextView with `visibility="gone"`. -->
44             <include layout="@layout/adview" />
45
46             <!-- Setting the CoordinatorLayout to be `focusableInTouchMode` prevents the URL text box from stealing focus on launch and opening the keyboard. -->
47             <androidx.coordinatorlayout.widget.CoordinatorLayout
48                 android:layout_height="match_parent"
49                 android:layout_width="match_parent"
50                 android:layout_above="@id/adview"
51                 android:focusable="true"
52                 android:focusableInTouchMode="true" >
53
54                 <!-- The theme has to be defined here because the activity uses a `NoActionBar` theme. -->
55                 <com.google.android.material.appbar.AppBarLayout
56                     android:id="@+id/appbar_layout"
57                     android:layout_height="wrap_content"
58                     android:layout_width="match_parent"
59                     android:theme="@style/PrivacyBrowserAppBarLight" >
60
61                     <androidx.appcompat.widget.Toolbar
62                         android:id="@+id/toolbar"
63                         android:layout_height="wrap_content"
64                         android:layout_width="match_parent"
65                         app:layout_scrollFlags="scroll|enterAlways|snap"
66                         android:visibility="gone" />
67
68                     <!-- The find on page linear layout.  It is initially `visibility="gone"`. -->
69                     <LinearLayout
70                         android:id="@+id/find_on_page_linearlayout"
71                         android:layout_height="wrap_content"
72                         android:layout_width="match_parent"
73                         android:orientation="horizontal"
74                         android:visibility="gone"
75                         app:layout_scrollFlags="scroll|enterAlways|snap" >
76
77                         <!-- `android:imeOptions="actionDone"` sets the keyboard to have a `check mark` key instead of a `new line` key. -->
78                         <EditText
79                             android:id="@+id/find_on_page_edittext"
80                             android:layout_height="wrap_content"
81                             android:layout_width="0dp"
82                             android:layout_weight="1"
83                             android:layout_marginStart="8dp"
84                             android:layout_marginEnd="4dp"
85                             android:hint="@string/find_on_page"
86                             android:lines="1"
87                             android:imeOptions="actionDone"
88                             android:inputType="text"
89                             tools:ignore="Autofill" />
90
91                         <TextView
92                             android:id="@+id/find_on_page_count_textview"
93                             android:layout_height="wrap_content"
94                             android:layout_width="wrap_content"
95                             android:layout_marginStart="4dp"
96                             android:layout_marginEnd="4dp"
97                             android:text="@string/zero_of_zero" />
98
99                         <ImageView
100                             android:id="@+id/find_previous"
101                             android:src="@drawable/previous"
102                             android:layout_width="35dp"
103                             android:layout_height="35dp"
104                             android:layout_marginStart="4dp"
105                             android:layout_marginEnd="4dp"
106                             android:layout_gravity="center_vertical"
107                             android:tint="?attr/findOnPageIconTintColor"
108                             android:contentDescription="@string/previous"
109                             android:onClick="findPreviousOnPage" />
110
111                         <ImageView
112                             android:id="@+id/find_next"
113                             android:src="@drawable/next"
114                             android:layout_width="35dp"
115                             android:layout_height="35dp"
116                             android:layout_marginStart="4dp"
117                             android:layout_marginEnd="4dp"
118                             android:layout_gravity="center_vertical"
119                             android:tint="?attr/findOnPageIconTintColor"
120                             android:contentDescription="@string/next"
121                             android:onClick="findNextOnPage" />
122
123                         <ImageView
124                             android:id="@+id/close_find"
125                             android:src="@drawable/close_light"
126                             android:layout_width="35dp"
127                             android:layout_height="35dp"
128                             android:layout_marginStart="4dp"
129                             android:layout_marginEnd="8dp"
130                             android:layout_gravity="center_vertical"
131                             android:tint="?attr/findOnPageIconTintColor"
132                             android:contentDescription="@string/close"
133                             android:onClick="closeFindOnPage" />
134                     </LinearLayout>
135
136                     <LinearLayout
137                         android:id="@+id/tabs_linearlayout"
138                         android:layout_height="wrap_content"
139                         android:layout_width="wrap_content"
140                         android:orientation="horizontal"
141                         app:layout_scrollFlags="scroll|enterAlways|snap"
142                         android:visibility="gone" >
143
144                         <ImageView
145                             android:layout_height="wrap_content"
146                             android:layout_width="wrap_content"
147                             android:layout_gravity="center_vertical"
148                             android:paddingStart="10dp"
149                             android:paddingEnd="10dp"
150                             android:src="@drawable/close_light"
151                             android:tint="?attr/addTabIconTintColor"
152                             android:onClick="closeTab"
153                             android:contentDescription="@string/close_tab" />
154
155                         <com.google.android.material.tabs.TabLayout
156                             android:id="@+id/tablayout"
157                             android:layout_height="wrap_content"
158                             android:layout_width="0dp"
159                             android:layout_weight="1"
160                             app:tabIndicatorGravity="top"
161                             app:tabMode="scrollable" />
162
163                         <ImageView
164                             android:layout_height="wrap_content"
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_light"
170                             android:tint="?attr/addTabIconTintColor"
171                             android:onClick="addTab"
172                             android:contentDescription="@string/add_tab" />
173                     </LinearLayout>
174                 </com.google.android.material.appbar.AppBarLayout>
175
176                 <!-- `app:layout_behavior="@string/appbar_scrolling_view_behavior"` must be set on the sibling of AppBarLayout. -->
177                 <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
178                     android:id="@+id/swiperefreshlayout"
179                     android:layout_width="match_parent"
180                     android:layout_height="match_parent"
181                     app:layout_behavior="@string/appbar_scrolling_view_behavior" >
182
183                         <com.stoutner.privacybrowser.views.NoSwipeViewPager
184                             android:id="@+id/webviewpager"
185                             android:layout_width="match_parent"
186                             android:layout_height="match_parent" />
187                 </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
188             </androidx.coordinatorlayout.widget.CoordinatorLayout>
189         </RelativeLayout>
190
191         <!-- The navigation drawer. -->
192         <com.google.android.material.navigation.NavigationView
193             android:id="@+id/navigationview"
194             android:layout_height="match_parent"
195             android:layout_width="wrap_content"
196             android:layout_gravity="start"
197             app:headerLayout="@layout/navigation_header"
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:textColor="?android:textColorPrimary" />
235     </RelativeLayout>
236 </FrameLayout>