Partial bookmarks drawer implemention.
[PrivacyBrowser.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.
29          When it is specified, the theme should include `<item name="android:windowTranslucentStatus">true</item>`.
30          Setting the layout root to be `focusableInTouchMode` prevents `urlTextBox` from stealing focus on launch and opening the keyboard. -->
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
41         <!-- The purpose of the `LinearLayout` is to place the included `main_webview` below `app_bar_layout`. -->
42         <LinearLayout
43             android:layout_height="match_parent"
44             android:layout_width="match_parent"
45             android:orientation="vertical" >
46
47             <!-- The `AppBarLayout` theme has to be defined here because the activity uses a `NoActionBar` theme. -->
48             <android.support.design.widget.AppBarLayout
49                 android:id="@+id/app_bar_layout"
50                 android:layout_height="wrap_content"
51                 android:layout_width="match_parent"
52                 android:theme="@style/PrivacyBrowserAppBarLight" >
53
54                 <!-- The `FrameLayout` allows `appBar` and `find_on_page_app_bar` to occupy the same space. -->
55                 <FrameLayout
56                     android:layout_height="wrap_content"
57                     android:layout_width="match_parent" >
58
59                     <android.support.v7.widget.Toolbar
60                         android:id="@+id/app_bar"
61                         android:layout_height="wrap_content"
62                         android:layout_width="match_parent" />
63
64                     <!-- `android:max` changes the maximum `ProgressBar` value from 10000 to 100 to match progress percentage.
65                         `android:layout_height="2dp"` works best for API >= 23, but `3dp` is required for visibility on API <= 22.
66                         `tools:ignore="UnusedAttribute"` removes the lint waring about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
67                     <ProgressBar
68                         android:id="@+id/progress_bar"
69                         style="?android:attr/progressBarStyleHorizontal"
70                         android:layout_width="fill_parent"
71                         android:layout_height="3dp"
72                         android:layout_gravity="bottom"
73                         android:max="100"
74                         android:progressTint="?attr/progressTintColor"
75                         android:progressBackgroundTint="@color/transparent"
76                         android:visibility="gone"
77                         tools:ignore="UnusedAttribute" />
78
79                     <include layout="@layout/find_on_page_app_bar" />
80                 </FrameLayout>
81             </android.support.design.widget.AppBarLayout>
82
83             <include layout="@layout/main_webview" />
84         </LinearLayout>
85
86         <!-- `full_screen_video_framelayout` is used to display full screen videos.  It is initially `android:visibility="gone"` to hide it from view. -->
87         <FrameLayout
88             android:id="@+id/full_screen_video_framelayout"
89             android:layout_height="match_parent"
90             android:layout_width="match_parent"
91             android:visibility="gone"
92             android:background="@color/black" />
93     </android.support.design.widget.CoordinatorLayout>
94
95     <!-- The navigation drawer. -->
96     <android.support.design.widget.NavigationView
97         android:id="@+id/navigationview"
98         android:layout_height="match_parent"
99         android:layout_width="wrap_content"
100         android:layout_gravity="start"
101         app:headerLayout="@layout/navigation_header"
102         app:menu="@menu/webview_navigation_menu"
103         app:itemIconTint="?attr/navigationIconTintColor" />
104
105     <!-- The bookmarks drawer. -->
106     <FrameLayout
107         android:id="@+id/bookmarks_framelayout"
108         android:layout_height="match_parent"
109         android:layout_width="wrap_content"
110         android:layout_gravity="end" >
111
112         <LinearLayout
113             android:layout_height="match_parent"
114             android:layout_width="wrap_content"
115             android:orientation="vertical" >
116
117             <TextView
118                 android:id="@+id/bookmarks_title_textview"
119                 android:layout_height="wrap_content"
120                 android:layout_width="match_parent"
121                 android:paddingTop="35dp"
122                 android:paddingBottom="8dp"
123                 android:paddingStart="15dp"
124                 android:paddingEnd="15dp"
125                 android:textStyle="bold"
126                 android:textSize="20sp"
127                 android:background="?attr/navigationHeaderBackground"
128                 android:textColor="?attr/navigationHeaderTextColor" />
129
130             <ListView
131                 android:id="@+id/bookmarks_drawer_listview"
132                 android:layout_height="0dp"
133                 android:layout_width="match_parent"
134                 android:layout_weight="1"
135                 android:divider="@color/transparent"
136                 android:dividerHeight="0dp" />
137         </LinearLayout>
138
139         <android.support.design.widget.FloatingActionButton
140             android:id="@+id/create_bookmark_folder_fab"
141             android:layout_height="wrap_content"
142             android:layout_width="wrap_content"
143             android:layout_gravity="bottom|end"
144             android:layout_marginEnd="16dp"
145             android:layout_marginBottom="85dp" />
146
147         <android.support.design.widget.FloatingActionButton
148             android:id="@+id/create_bookmark_fab"
149             android:layout_height="wrap_content"
150             android:layout_width="wrap_content"
151             android:layout_gravity="bottom|end"
152             android:layout_margin="16dp" />
153     </FrameLayout>
154 </android.support.v4.widget.DrawerLayout>