Temporal edge navigation feature

- User can swipe from left and right edge to go
  back and forward in history of a tab

Change-Id: I941f91122510b004bdcb6a718eb6c05730694960
diff --git a/res/drawable-xxhdpi/deco_swipe_spatial.png b/res/drawable-xxhdpi/deco_swipe_spatial.png
new file mode 100644
index 0000000..d95ef9b
--- /dev/null
+++ b/res/drawable-xxhdpi/deco_swipe_spatial.png
Binary files differ
diff --git a/res/drawable-xxhdpi/deco_swipe_temporal.png b/res/drawable-xxhdpi/deco_swipe_temporal.png
new file mode 100644
index 0000000..30529c1
--- /dev/null
+++ b/res/drawable-xxhdpi/deco_swipe_temporal.png
Binary files differ
diff --git a/res/drawable-xxhdpi/left_shade.png b/res/drawable-xxhdpi/left_shade.png
new file mode 100644
index 0000000..94f7c1c
--- /dev/null
+++ b/res/drawable-xxhdpi/left_shade.png
Binary files differ
diff --git a/res/drawable-xxhdpi/right_shade.png b/res/drawable-xxhdpi/right_shade.png
new file mode 100644
index 0000000..3ae50fa
--- /dev/null
+++ b/res/drawable-xxhdpi/right_shade.png
Binary files differ
diff --git a/res/layout/tab.xml b/res/layout/tab.xml
index 8bf3327..0c25901 100755
--- a/res/layout/tab.xml
+++ b/res/layout/tab.xml
@@ -19,21 +19,127 @@
      Currently, the only such element is the Geolocation permissions prompt.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.browser.DraggableFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/draggable_mainframe"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <ImageView android:id="@+id/navview_opacity"
+        android:layout_gravity="top"
+        android:scaleType="fitStart"
+        android:background="@android:color/black"
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
+    <ImageView android:id="@+id/stationary_navview"
+        android:layout_gravity="top"
+        android:scaleType="fitStart"
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
     <!-- Wrapper layout for the WebView, which must be in a FrameLayout. -->
     <FrameLayout android:id="@+id/webview_wrapper"
         android:layout_width="match_parent"
-        android:layout_height="0dip"
+        android:layout_height="match_parent"
         android:layout_weight="1" />
 
+    <ImageView android:id="@+id/sliding_navview"
+        android:layout_gravity="top"
+        android:scaleType="fitStart"
+        android:visibility="gone"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
+    <ImageView android:id="@+id/sliding_navview_shadow"
+        android:background="@drawable/left_shade"
+        android:layout_gravity="top"
+        android:scaleType="fitStart"
+        android:visibility="gone"
+        android:layout_width="10dp"
+        android:layout_height="match_parent" />
+
+    <LinearLayout android:id="@+id/edge_sliding_settings"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:visibility="gone"
+        android:background="#00838f"
+        android:alpha="0.85"
+        android:orientation="vertical">
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:gravity="center_horizontal|center_vertical"
+            android:layout_weight=".25"
+            android:textSize="32sp"
+            android:textColor="@color/white"
+            android:text="@string/pref_edge_swipe_title"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:textSize="21sp"
+            android:textColor="@color/white"
+            android:text="@string/pref_edge_swipe_option_msg"/>
+
+        <RadioGroup
+            android:id="@+id/edge_sliding_settings_options"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight=".25"
+            android:layout_gravity="center_horizontal"
+            android:padding="10dp"
+            android:orientation="vertical">
+            <RadioButton
+                android:id="@+id/edge_sliding_settings_options_temporal"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/pref_temporal_edge_swipe"
+                android:textColor="@color/white"
+                android:drawableEnd="@drawable/deco_swipe_temporal"
+                android:textSize="18sp"
+                android:padding="10dp"/>
+            <RadioButton
+                android:id="@+id/edge_sliding_settings_options_spatial"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/pref_spatial_edge_swipe"
+                android:textColor="@color/white"
+                android:drawableEnd="@drawable/deco_swipe_spatial"
+                android:textSize="18sp"
+                android:visibility="gone"
+                android:padding="10dp"/>
+            <RadioButton
+                android:id="@+id/edge_sliding_settings_options_disabled"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/pref_disable_edge_swipe"
+                android:textColor="@color/white"
+                android:textSize="18sp"
+                android:padding="10dp"/>
+        </RadioGroup>
+
+        <Button
+            android:id="@+id/edge_sliding_settings_close_btn"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/pref_edge_swipe_option_close"
+            android:padding="10dp"
+            android:gravity="center_horizontal|center_vertical"
+            android:layout_gravity="center"
+            style="@android:style/Widget.Holo.Button.Borderless"/>
+
+    </LinearLayout>
+
     <!-- Geolocation permissions prompt -->
     <ViewStub android:id="@+id/geolocation_permissions_prompt"
         android:layout="@layout/geolocation_permissions_prompt"
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
-</LinearLayout>
+
+</com.android.browser.DraggableFrameLayout>
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index 7f0e63e..0cb0edf 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -503,4 +503,11 @@
 
     <!-- Toast message displayed when user attempts to modify a setting disabled by the administrator -->
     <string name="mdm_managed_alert">被管理员禁用</string>
+
+    <string name="pref_edge_swipe_title">边缘滑动</string>
+    <string name="pref_edge_swipe_option_msg">滑过屏幕边缘时,您想:</string>
+    <string name="pref_temporal_edge_swipe">上一个/下一个网站</string>
+    <string name="pref_spatial_edge_swipe">更换标签页</string>
+    <string name="pref_disable_edge_swipe">禁用边缘滑动</string>
+    <string name="pref_edge_swipe_option_close">关闭</string>
 </resources>
diff --git a/res/values-zh-rHK/strings.xml b/res/values-zh-rHK/strings.xml
index 225ba12..77340b0 100644
--- a/res/values-zh-rHK/strings.xml
+++ b/res/values-zh-rHK/strings.xml
@@ -500,4 +500,10 @@
     <string name="accessibility_transition_navscreen" msgid="2734915619351519547">"標籤管理"</string>
     <string name="accessibility_button_bookmarks_folder_up" msgid="9179389954714270505">"上一個資料夾"</string>
     <string name="mdm_managed_alert">被管理員禁用</string>
+    <string name="pref_edge_swipe_title">邊緣滑動</string>
+    <string name="pref_edge_swipe_option_msg">滑過邊緣時,您想:</string>
+    <string name="pref_temporal_edge_swipe">上一個/下一個網站</string>
+    <string name="pref_spatial_edge_swipe">更換標籤頁</string>
+    <string name="pref_disable_edge_swipe">禁用邊緣滑動</string>
+    <string name="pref_edge_swipe_option_close">關閉</string>
 </resources>
diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml
index 3ff6708..0c3486d 100644
--- a/res/values-zh-rTW/strings.xml
+++ b/res/values-zh-rTW/strings.xml
@@ -412,4 +412,10 @@
     <string name="help">"幫助"</string>
     <string name="feedback">"反饋"</string>
     <string name="mdm_managed_alert">被管理員禁用</string>
+    <string name="pref_edge_swipe_title">邊緣滑動</string>
+    <string name="pref_edge_swipe_option_msg">滑過邊緣時,您想:</string>
+    <string name="pref_temporal_edge_swipe">上一個/下一個網站</string>
+    <string name="pref_spatial_edge_swipe">更換標籤頁</string>
+    <string name="pref_disable_edge_swipe">禁用邊緣滑動</string>
+    <string name="pref_edge_swipe_option_close">關閉</string>
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fdfcc9d..7d2ed69 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -638,6 +638,36 @@
         <item>auto</item>
     </string-array>
     <string name="pref_default_text_encoding_default">UTF-8</string>
+    <string name="pref_edge_swipe_title">Edge Swipe</string>
+    <string name="pref_edge_swipe_option_msg">When swiping, would you like:</string>
+    <string name="pref_temporal_edge_swipe">Previous/Next Web Site</string>
+    <string name="pref_spatial_edge_swipe">Change Tab</string>
+    <string name="pref_disable_edge_swipe">Disable edge swipe</string>
+    <string name="pref_edge_swipe_option_close">Close</string>
+    <string name="pref_temporal_edge_swipe_enabled_toast">Swipe from edge to navigate</string>
+    <string name="pref_spatial_edge_swipe_enabled_toast">Swipe from edge to change tabs</string>
+    <string name="pref_edge_swipe_disabled_toast">Swiping from edge disabled</string>
+    <string-array name="pref_edge_swiping_choices">
+        <item>@string/pref_temporal_edge_swipe</item>
+<!--
+        <item>@string/pref_spatial_edge_swipe</item>
+-->
+        <item>@string/pref_disable_edge_swipe</item>
+    </string-array>
+
+    <string name="value_temporal_edge_swipe"  translatable="false">temporal_edge_swipe</string>
+    <string name="value_spatial_edge_swipe"  translatable="false">spatial_edge_swipe</string>
+    <string name="value_disable_edge_swipe"  translatable="false">disable_edge_swipe</string>
+    <string name="value_unknown_edge_swipe"  translatable="false">unknown_edge_swipe</string>
+
+    <string-array name="pref_edge_swiping_values" translatable="false">
+        <item>@string/value_temporal_edge_swipe</item>
+<!--
+        <item>@string/value_spatial_edge_swipe</item>
+-->
+        <item>@string/value_disable_edge_swipe</item>
+    </string-array>
+
     <!-- Title for accessibility settings [CHAR LIMIT=25] -->
     <string name="pref_accessibility_title">Accessibility</string>
     <!-- Font size settings category under accessibility settings [CHAR LIMIT=50] -->
diff --git a/res/xml/general_preferences.xml b/res/xml/general_preferences.xml
index 662ef30..abd7b73 100644
--- a/res/xml/general_preferences.xml
+++ b/res/xml/general_preferences.xml
@@ -200,6 +200,13 @@
             android:summary="@string/pref_extras_website_settings_summary"
             android:title="@string/pref_extras_website_settings" />
 
+        <ListPreference
+            android:dialogTitle="@string/pref_edge_swipe_option_msg"
+            android:entries="@array/pref_edge_swiping_choices"
+            android:entryValues="@array/pref_edge_swiping_values"
+            android:key="edge_swiping_action"
+            android:title="@string/pref_edge_swipe_title" />
+
         <com.android.browser.BrowserYesNoPreference
             android:key="reset_default_preferences"
             android:title="@string/pref_extras_reset_default"