]> gitweb.stoutner.com Git - PrivacyBrowserAndroid.git/blob - app/src/main/res/layout/activity_webview.xml
Implement swipe to refresh.
[PrivacyBrowserAndroid.git] / app / src / main / res / layout / activity_webview.xml
1 <android.support.v4.widget.SwipeRefreshLayout
2     android:id="@+id/swipeRefreshLayoutContainer"
3     xmlns:android="http://schemas.android.com/apk/res/android"
4     android:layout_width="match_parent"
5     android:layout_height="match_parent">
6     // SwipeRefreshLayout allows the user to swipe down to refresh.
7
8     <RelativeLayout
9         android:id="@+id/relativeLayoutContainer"
10         xmlns:android="http://schemas.android.com/apk/res/android"
11         xmlns:tools="http://schemas.android.com/tools"
12         android:layout_width="match_parent"
13         android:layout_height="match_parent"
14         tools:context=".Webview" >
15
16         // FrameLayout lets the ProgressBar float on top of the LinearLayout.
17         <FrameLayout
18             android:id="@+id/addressBarFrameLayout"
19             android:layout_width="match_parent"
20             android:layout_height="wrap_content">
21
22             <LinearLayout
23                 android:id="@+id/addressBarLinearLayout"
24                 android:layout_width="match_parent"
25                 android:layout_height="wrap_content"
26                 android:orientation="horizontal">
27
28                 // android:inputType="textUri" sets the keyboard to have a go arrow.
29                 <EditText
30                     android:id="@+id/urlTextBox"
31                     android:layout_width="0dp"
32                     android:layout_height="wrap_content"
33                     android:inputType="textUri"
34                     android:imeOptions="actionGo"
35                     android:layout_weight="1"/>
36
37                 <Button
38                     android:id="@+id/goButton"
39                     android:text="@string/go_button"
40                     android:onClick="loadUrlFromTextBox"
41                     style="?android:attr/buttonStyleSmall"
42                     android:layout_width="wrap_content"
43                     android:layout_height="wrap_content" />
44
45             </LinearLayout>
46
47             // android:max changes the maximum ProgressBar value from 10000 to 100 to match progress percentage.
48             <ProgressBar
49                 android:id="@+id/progressBar"
50                 style="?android:attr/progressBarStyleHorizontal"
51                 android:layout_width="fill_parent"
52                 android:layout_height="7dp"
53                 android:layout_gravity="bottom"
54                 android:max="100"
55                 android:progressTint="#FF0097FF"
56                 android:progressBackgroundTint="#FFFFFFFF"
57                 android:visibility="gone" />
58         </FrameLayout>
59
60
61         <WebView
62             android:id="@+id/mainWebView"
63             android:layout_width="match_parent"
64             android:layout_height="match_parent"
65             android:layout_below="@id/addressBarFrameLayout"
66             android:focusable="true"
67             android:focusableInTouchMode="true" />
68
69     </RelativeLayout>
70
71 </android.support.v4.widget.SwipeRefreshLayout>