1 <?xml version="1.0" encoding="utf-8"?>
4 Copyright © 2015-2017,2019 Soren Stoutner <soren@stoutner.com>.
6 This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>>.
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.
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.
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/>. -->
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" >
29 <androidx.drawerlayout.widget.DrawerLayout
30 android:id="@+id/drawerlayout"
31 android:layout_height="match_parent"
32 android:layout_width="match_parent" >
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>`. -->
38 android:id="@+id/main_content_relativelayout"
39 android:layout_height="match_parent"
40 android:layout_width="match_parent"
41 android:fitsSystemWindows="true" >
43 <!-- Include the AdView. For the standard flavor, this just includes a TextView with `visibility="gone"`. -->
44 <include layout="@layout/adview" />
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" >
54 <!-- The theme has to be defined here because the activity uses a `NoActionBar` theme. -->
55 <com.google.android.material.appbar.AppBarLayout
56 android:layout_height="wrap_content"
57 android:layout_width="match_parent"
58 android:theme="@style/PrivacyBrowserAppBarLight" >
60 <!-- The frame layout allows the toolbar, progress bar, and find on page bar to occupy the same space. The scroll flags should be set on the immediate child of AppBarLayout. -->
62 android:layout_height="wrap_content"
63 android:layout_width="match_parent"
64 app:layout_scrollFlags="scroll|enterAlways|snap" >
66 <androidx.appcompat.widget.Toolbar
67 android:id="@+id/toolbar"
68 android:layout_height="wrap_content"
69 android:layout_width="match_parent" />
71 <!-- `android:max` changes the maximum `ProgressBar` value from 10000 to 100 to match progress percentage.
72 `android:layout_height="2dp"` works best for API >= 23, but `3dp` is required for visibility on API <= 22.
73 `tools:ignore="UnusedAttribute"` removes the lint warning about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
75 android:id="@+id/progress_bar"
76 style="?android:attr/progressBarStyleHorizontal"
77 android:layout_height="3dp"
78 android:layout_width="match_parent"
79 android:layout_gravity="bottom"
81 android:progressTint="?attr/progressTintColor"
82 android:progressBackgroundTint="@color/transparent"
83 android:visibility="gone"
84 tools:ignore="UnusedAttribute" />
86 <!-- The find on page linear layout. It is initially `visibility="gone"`. -->
88 android:id="@+id/find_on_page_linearlayout"
89 android:layout_height="wrap_content"
90 android:layout_width="match_parent"
91 android:orientation="horizontal"
92 android:visibility="gone" >
94 <!-- `android:imeOptions="actionDone"` sets the keyboard to have a `check mark` key instead of a `new line` key. -->
96 android:id="@+id/find_on_page_edittext"
97 android:layout_height="wrap_content"
98 android:layout_width="0dp"
99 android:layout_weight="1"
100 android:layout_marginStart="8dp"
101 android:layout_marginEnd="4dp"
102 android:hint="@string/find_on_page"
104 android:imeOptions="actionDone"
105 android:inputType="text"
106 tools:ignore="Autofill" />
109 android:id="@+id/find_on_page_count_textview"
110 android:layout_height="wrap_content"
111 android:layout_width="wrap_content"
112 android:layout_marginStart="4dp"
113 android:layout_marginEnd="4dp"
114 android:text="@string/zero_of_zero" />
117 android:id="@+id/find_previous"
118 android:src="@drawable/previous"
119 android:layout_width="35dp"
120 android:layout_height="35dp"
121 android:layout_marginStart="4dp"
122 android:layout_marginEnd="4dp"
123 android:layout_gravity="center_vertical"
124 android:tint="?attr/findOnPageIconTintColor"
125 android:contentDescription="@string/previous"
126 android:onClick="findPreviousOnPage" />
129 android:id="@+id/find_next"
130 android:src="@drawable/next"
131 android:layout_width="35dp"
132 android:layout_height="35dp"
133 android:layout_marginStart="4dp"
134 android:layout_marginEnd="4dp"
135 android:layout_gravity="center_vertical"
136 android:tint="?attr/findOnPageIconTintColor"
137 android:contentDescription="@string/next"
138 android:onClick="findNextOnPage" />
141 android:id="@+id/close_find"
142 android:src="@drawable/close_light"
143 android:layout_width="35dp"
144 android:layout_height="35dp"
145 android:layout_marginStart="4dp"
146 android:layout_marginEnd="8dp"
147 android:layout_gravity="center_vertical"
148 android:tint="?attr/findOnPageIconTintColor"
149 android:contentDescription="@string/close"
150 android:onClick="closeFindOnPage" />
153 </com.google.android.material.appbar.AppBarLayout>
155 <!-- `app:layout_behavior="@string/appbar_scrolling_view_behavior"` must be set on the sibling of AppBarLayout. -->
156 <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
157 android:id="@+id/swiperefreshlayout"
158 android:layout_width="match_parent"
159 android:layout_height="match_parent"
160 app:layout_behavior="@string/appbar_scrolling_view_behavior" >
162 <com.stoutner.privacybrowser.views.NestedScrollWebView
163 android:id="@+id/main_webview"
164 android:layout_height="match_parent"
165 android:layout_width="match_parent"
166 android:focusable="true"
167 android:focusableInTouchMode="true" />
168 </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
169 </androidx.coordinatorlayout.widget.CoordinatorLayout>
172 <!-- The navigation drawer. -->
173 <com.google.android.material.navigation.NavigationView
174 android:id="@+id/navigationview"
175 android:layout_height="match_parent"
176 android:layout_width="wrap_content"
177 android:layout_gravity="start"
178 app:headerLayout="@layout/navigation_header"
179 app:menu="@menu/webview_navigation_menu"
180 app:itemIconTint="?attr/navigationIconTintColor" />
182 <!-- Include the bookmarks drawer, which varies based on screen width. -->
183 <include layout="@layout/bookmarks_drawer" />
184 </androidx.drawerlayout.widget.DrawerLayout>
186 <!-- `The full screen video frame layout is used to display full screen videos. It is initially `android:visibility="gone"` to hide it from view. -->
188 android:id="@+id/full_screen_video_framelayout"
189 android:layout_height="match_parent"
190 android:layout_width="match_parent"
191 android:visibility="gone" />