Add a ripple touch animation to the New Tab and Close Tab buttons. https://redmine...
[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 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                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
145                         <ImageView
146                             android:layout_height="match_parent"
147                             android:layout_width="wrap_content"
148                             android:layout_gravity="center_vertical"
149                             android:paddingStart="10dp"
150                             android:paddingEnd="10dp"
151                             android:src="@drawable/close_light"
152                             android:tint="?attr/addTabIconTintColor"
153                             android:background="?attr/selectableItemBackground"
154                             android:onClick="closeTab"
155                             android:contentDescription="@string/close_tab" />
156
157                         <com.google.android.material.tabs.TabLayout
158                             android:id="@+id/tablayout"
159                             android:layout_height="wrap_content"
160                             android:layout_width="0dp"
161                             android:layout_weight="1"
162                             app:tabIndicatorGravity="top"
163                             app:tabMode="scrollable" />
164
165                         <!-- `android:background="?attr/selectableItemBackground"` adds a ripple animation on touch. -->
166                         <ImageView
167                             android:layout_height="match_parent"
168                             android:layout_width="wrap_content"
169                             android:layout_gravity="center_vertical"
170                             android:paddingStart="10dp"
171                             android:paddingEnd="10dp"
172                             android:src="@drawable/add_light"
173                             android:tint="?attr/addTabIconTintColor"
174                             android:background="?attr/selectableItemBackground"
175                             android:onClick="addTab"
176                             android:contentDescription="@string/add_tab" />
177                     </LinearLayout>
178                 </com.google.android.material.appbar.AppBarLayout>
179
180                 <!-- `app:layout_behavior="@string/appbar_scrolling_view_behavior"` must be set on the sibling of AppBarLayout. -->
181                 <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
182                     android:id="@+id/swiperefreshlayout"
183                     android:layout_width="match_parent"
184                     android:layout_height="match_parent"
185                     app:layout_behavior="@string/appbar_scrolling_view_behavior" >
186
187                         <com.stoutner.privacybrowser.views.NoSwipeViewPager
188                             android:id="@+id/webviewpager"
189                             android:layout_width="match_parent"
190                             android:layout_height="match_parent" />
191                 </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
192             </androidx.coordinatorlayout.widget.CoordinatorLayout>
193         </RelativeLayout>
194
195         <!-- The navigation drawer. -->
196         <com.google.android.material.navigation.NavigationView
197             android:id="@+id/navigationview"
198             android:layout_height="match_parent"
199             android:layout_width="wrap_content"
200             android:layout_gravity="start"
201             app:headerLayout="@layout/navigation_header"
202             app:menu="@menu/webview_navigation_menu"
203             app:itemIconTint="?attr/navigationIconTintColor" />
204
205         <!-- Include the bookmarks drawer, which varies based on screen width. -->
206         <include layout="@layout/bookmarks_drawer" />
207     </androidx.drawerlayout.widget.DrawerLayout>
208
209     <!-- The full screen video frame layout is used to display full screen videos.  It is initially `android:visibility="gone"` to hide it from view. -->
210     <FrameLayout
211         android:id="@+id/full_screen_video_framelayout"
212         android:layout_height="match_parent"
213         android:layout_width="match_parent"
214         android:visibility="gone" />
215
216     <!-- The loading blocklists relative layout displays when the app first starts.  It is hidden once the blocklists are populated. -->
217     <RelativeLayout
218         android:id="@+id/loading_blocklists_relativelayout"
219         android:layout_width="match_parent"
220         android:layout_height="match_parent">
221
222         <ImageView
223             android:id="@+id/privacy_browser_logo"
224             android:layout_height="256dp"
225             android:layout_width="256dp"
226             android:layout_centerInParent="true"
227             android:src="@drawable/privacy_browser_foreground"
228             tools:ignore="contentDescription" />
229
230         <TextView
231             android:id="@+id/loading_blocklist_textview"
232             android:layout_width="wrap_content"
233             android:layout_height="wrap_content"
234             android:layout_below="@id/privacy_browser_logo"
235             android:layout_centerHorizontal="true"
236             android:layout_margin="10dp"
237             android:textSize="16sp"
238             android:textAlignment="center"
239             android:textColor="?android:textColorPrimary" />
240     </RelativeLayout>
241 </FrameLayout>