]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blob - app/src/main/res/layout/url_app_bar.xml
Implement automatic loading of privacy settings.
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / url_app_bar.xml
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4   Copyright 2015-2016 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` lets the `ProgressBar` float on top of `urlTextBox`. -->
22 <FrameLayout
23     android:id="@+id/url_app_bar_framelayout"
24     xmlns:tools="http://schemas.android.com/tools"
25     xmlns:android="http://schemas.android.com/apk/res/android"
26     android:layout_height="wrap_content"
27     android:layout_width="match_parent"
28     tools:context=".activities.MainWebViewActivity" >
29
30     <!-- `RelativeLayout` is used instead of a `LinearLayout` because `supportAppBar` does not let `android:layout_weight="1"` cause `urlTextBox` to fill all the available space. -->
31     <RelativeLayout
32         android:layout_height="wrap_content"
33         android:layout_width="match_parent" >
34
35         <!-- Set the program icon as the initial `favoriteIcon`.
36             `layout_height` and `layout_width` of 26dp matches the `AppBar` icons. -->
37         <ImageView
38             android:id="@+id/favoriteIcon"
39             android:src="@drawable/world"
40             android:layout_height="26dp"
41             android:layout_width="26dp"
42             android:layout_centerVertical="true"
43             android:onClick="viewSslCertificate"
44             android:contentDescription="@string/favorite_icon" />
45
46         <!-- `android:imeOptions="actionGo"` sets the keyboard to have a `go` key instead of a `new line` key.
47             `android:inputType="textUri"` disables spell check in the `EditText`. -->
48         <EditText
49             android:id="@+id/urlTextBox"
50             android:layout_height="wrap_content"
51             android:layout_width="match_parent"
52             android:layout_toEndOf="@id/favoriteIcon"
53             android:hint="@string/url_or_search_terms"
54             android:imeOptions="actionGo"
55             android:inputType="textUri" />
56     </RelativeLayout>
57
58     <!-- `android:max` changes the maximum `ProgressBar` value from 10000 to 100 to match progress percentage.
59         `android:layout_height="2dp"` works best for API 23 Marshmallow, but `3dp` is required for visibility on API <= 22.
60         `tools:ignore="UnusedAttribute"` removes the lint waring about `progressTint` and `progressBackgroundTint` not applying to API < 21. -->
61     <ProgressBar
62         android:id="@+id/progressBar"
63         style="?android:attr/progressBarStyleHorizontal"
64         android:layout_width="fill_parent"
65         android:layout_height="3dp"
66         android:layout_gravity="bottom"
67         android:max="100"
68         android:progressTint="@color/blue_700"
69         android:progressBackgroundTint="@color/white"
70         android:visibility="gone"
71         tools:ignore="UnusedAttribute" />
72 </FrameLayout>