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