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