Add a back arrow to the header of the bookmarks drawer. https://redmine.stoutner...
[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                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
96                         <ImageView
97                             android:id="@+id/find_previous"
98                             android:src="@drawable/previous"
99                             android:layout_width="35dp"
100                             android:layout_height="35dp"
101                             android:layout_marginStart="4dp"
102                             android:layout_marginEnd="4dp"
103                             android:layout_gravity="center_vertical"
104                             android:background="?attr/selectableItemBackground"
105                             android:contentDescription="@string/previous"
106                             android:onClick="findPreviousOnPage"
107                             app:tint="?attr/findOnPageIconTintColor" />
108
109                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
110                         <ImageView
111                             android:id="@+id/find_next"
112                             android:src="@drawable/next"
113                             android:layout_width="35dp"
114                             android:layout_height="35dp"
115                             android:layout_marginStart="4dp"
116                             android:layout_marginEnd="4dp"
117                             android:layout_gravity="center_vertical"
118                             android:background="?attr/selectableItemBackground"
119                             android:contentDescription="@string/next"
120                             android:onClick="findNextOnPage"
121                             app:tint="?attr/findOnPageIconTintColor" />
122
123                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
124                         <ImageView
125                             android:id="@+id/close_find"
126                             android:src="@drawable/close_day"
127                             android:layout_width="35dp"
128                             android:layout_height="35dp"
129                             android:layout_marginStart="4dp"
130                             android:layout_marginEnd="8dp"
131                             android:layout_gravity="center_vertical"
132                             android:background="?attr/selectableItemBackground"
133                             android:contentDescription="@string/close"
134                             android:onClick="closeFindOnPage"
135                             app:tint="?attr/findOnPageIconTintColor" />
136                     </LinearLayout>
137
138                     <!-- 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. -->
139                     <LinearLayout
140                         android:id="@+id/tabs_linearlayout"
141                         android:layout_height="wrap_content"
142                         android:layout_width="wrap_content"
143                         android:orientation="horizontal"
144                         android:visibility="gone"
145                         app:layout_scrollFlags="scroll|enterAlways|snap" >
146
147                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
148                         <ImageView
149                             android:layout_height="match_parent"
150                             android:layout_width="wrap_content"
151                             android:layout_gravity="center_vertical"
152                             android:paddingStart="10dp"
153                             android:paddingEnd="10dp"
154                             android:src="@drawable/close_day"
155                             android:background="?attr/selectableItemBackground"
156                             android:onClick="closeTab"
157                             android:contentDescription="@string/close_tab"
158                             app:tint="?attr/addTabIconTintColor" />
159
160                         <com.google.android.material.tabs.TabLayout
161                             android:id="@+id/tablayout"
162                             android:layout_height="wrap_content"
163                             android:layout_width="0dp"
164                             android:layout_weight="1"
165                             app:tabIndicatorGravity="top"
166                             app:tabMode="scrollable" />
167
168                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
169                         <ImageView
170                             android:layout_height="match_parent"
171                             android:layout_width="wrap_content"
172                             android:layout_gravity="center_vertical"
173                             android:paddingStart="10dp"
174                             android:paddingEnd="10dp"
175                             android:src="@drawable/add"
176                             android:background="?attr/selectableItemBackground"
177                             android:onClick="addTab"
178                             android:contentDescription="@string/add_tab"
179                             app:tint="?attr/addTabIconTintColor" />
180                     </LinearLayout>
181                 </com.google.android.material.appbar.AppBarLayout>
182
183                 <!-- `app:layout_behavior="@string/appbar_scrolling_view_behavior"` must be set on the sibling of AppBarLayout. -->
184                 <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
185                     android:id="@+id/swiperefreshlayout"
186                     android:layout_width="match_parent"
187                     android:layout_height="match_parent"
188                     app:layout_behavior="@string/appbar_scrolling_view_behavior" >
189
190                         <com.stoutner.privacybrowser.views.NoSwipeViewPager
191                             android:id="@+id/webviewpager"
192                             android:layout_width="match_parent"
193                             android:layout_height="match_parent" />
194                 </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
195             </androidx.coordinatorlayout.widget.CoordinatorLayout>
196         </RelativeLayout>
197
198         <!-- The navigation drawer. -->
199         <com.google.android.material.navigation.NavigationView
200             android:id="@+id/navigationview"
201             android:layout_height="match_parent"
202             android:layout_width="wrap_content"
203             android:layout_gravity="start"
204             app:menu="@menu/webview_navigation_menu"
205             app:itemIconTint="?attr/navigationIconTintColor" />
206
207         <!-- Include the bookmarks drawer, which varies based on screen width. -->
208         <include layout="@layout/bookmarks_drawer" />
209     </androidx.drawerlayout.widget.DrawerLayout>
210
211     <!-- The full screen video frame layout is used to display full screen videos.  It is initially `android:visibility="gone"` to hide it from view. -->
212     <FrameLayout
213         android:id="@+id/full_screen_video_framelayout"
214         android:layout_height="match_parent"
215         android:layout_width="match_parent"
216         android:visibility="gone" />
217
218     <!-- The loading blocklists relative layout displays when the app first starts.  It is hidden once the blocklists are populated. -->
219     <RelativeLayout
220         android:id="@+id/loading_blocklists_relativelayout"
221         android:layout_width="match_parent"
222         android:layout_height="match_parent">
223
224         <ImageView
225             android:id="@+id/privacy_browser_logo"
226             android:layout_height="256dp"
227             android:layout_width="256dp"
228             android:layout_centerInParent="true"
229             android:src="@drawable/privacy_browser_foreground"
230             tools:ignore="contentDescription" />
231
232         <TextView
233             android:id="@+id/loading_blocklist_textview"
234             android:layout_width="wrap_content"
235             android:layout_height="wrap_content"
236             android:layout_below="@id/privacy_browser_logo"
237             android:layout_centerHorizontal="true"
238             android:layout_margin="10dp"
239             android:textSize="16sp"
240             android:textAlignment="center"
241             android:textColor="?android:attr/textColorPrimary" />
242     </RelativeLayout>
243 </FrameLayout>