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