]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blob - app/src/main/res/layout/main_drawerlayout.xml
f58017911a47975939a6ec17895ec044c017982b
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / main_drawerlayout.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright © 2015-2017 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 <android.support.v4.widget.DrawerLayout
22     android:id="@+id/drawerlayout"
23     xmlns:android="http://schemas.android.com/apk/res/android"
24     xmlns:app="http://schemas.android.com/apk/res-auto"
25     android:layout_height="match_parent"
26     android:layout_width="match_parent" >
27
28     <!-- `android:fitsSystemWindows="true"` moves `root_coordinatorlayout` below the system status bar. When it is specified, the theme should include `<item name="android:windowTranslucentStatus">true</item>`.
29          Setting the CoordinatorLayout to be `focusableInTouchMode` prevents the URL text box from stealing focus on launch and opening the keyboard. -->
30     <android.support.design.widget.CoordinatorLayout
31         android:id="@+id/root_coordinatorlayout"
32         xmlns:tools="http://schemas.android.com/tools"
33         tools:context="com.stoutner.privacybrowser.activities.MainWebViewActivity"
34         android:layout_height="match_parent"
35         android:layout_width="match_parent"
36         android:fitsSystemWindows="true"
37         android:focusable="true"
38         android:focusableInTouchMode="true" >
39
40         <!-- The purpose of the `LinearLayout` is to place the included `main_webview` below `app_bar_layout`. -->
41         <LinearLayout
42             android:layout_height="match_parent"
43             android:layout_width="match_parent"
44             android:orientation="vertical" >
45
46             <!-- The `AppBarLayout` theme has to be defined here because the activity uses a `NoActionBar` theme. -->
47             <android.support.design.widget.AppBarLayout
48                 android:id="@+id/app_bar_layout"
49                 android:layout_height="wrap_content"
50                 android:layout_width="match_parent"
51                 android:theme="@style/PrivacyBrowserAppBarLight" >
52
53                 <!-- The `FrameLayout` allows `appBar` and `find_on_page_app_bar` to occupy the same space. -->
54                 <FrameLayout
55                     android:layout_height="wrap_content"
56                     android:layout_width="match_parent" >
57
58                     <android.support.v7.widget.Toolbar
59                         android:id="@+id/app_bar"
60                         android:layout_height="wrap_content"
61                         android:layout_width="match_parent" />
62
63                     <!-- `android:max` changes the maximum `ProgressBar` value from 10000 to 100 to match progress percentage.
64                         `android:layout_height="2dp"` works best for API >= 23, but `3dp` is required for visibility on API <= 22.
65                         `tools:ignore="UnusedAttribute"` removes the lint warning about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
66                     <ProgressBar
67                         android:id="@+id/progress_bar"
68                         style="?android:attr/progressBarStyleHorizontal"
69                         android:layout_height="3dp"
70                         android:layout_width="match_parent"
71                         android:layout_gravity="bottom"
72                         android:max="100"
73                         android:progressTint="?attr/progressTintColor"
74                         android:progressBackgroundTint="@color/transparent"
75                         android:visibility="gone"
76                         tools:ignore="UnusedAttribute" />
77
78                     <!-- Include the Find on Page search bar. -->
79                     <include layout="@layout/find_on_page_app_bar" />
80                 </FrameLayout>
81             </android.support.design.widget.AppBarLayout>
82
83             <!-- Include the main `WebView`. -->
84             <include layout="@layout/main_webview" />
85         </LinearLayout>
86
87         <!-- `full_screen_video_framelayout` is used to display full screen videos.  It is initially `android:visibility="gone"` to hide it from view. -->
88         <FrameLayout
89             android:id="@+id/full_screen_video_framelayout"
90             android:layout_height="match_parent"
91             android:layout_width="match_parent"
92             android:visibility="gone"
93             android:background="@color/black" />
94     </android.support.design.widget.CoordinatorLayout>
95
96     <!-- The navigation drawer. -->
97     <android.support.design.widget.NavigationView
98         android:id="@+id/navigationview"
99         android:layout_height="match_parent"
100         android:layout_width="wrap_content"
101         android:layout_gravity="start"
102         app:headerLayout="@layout/navigation_header"
103         app:menu="@menu/webview_navigation_menu"
104         app:itemIconTint="?attr/navigationIconTintColor" />
105
106     <!-- Include the bookmarks drawer. -->
107     <include layout="@layout/bookmarks_drawer" />
108 </android.support.v4.widget.DrawerLayout>