Move KeyboardView in the framework to LatinKeyboardViewBase

Change-Id: I99e3ea5eb1f1f5e5f9b36306930cdf0f50acfb01
diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_background.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_background.9.png
new file mode 100644
index 0000000..6ba42db
--- /dev/null
+++ b/java/res/drawable-hdpi/keyboard_key_feedback_background.9.png
Binary files differ
diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_more_background.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_more_background.9.png
new file mode 100644
index 0000000..4d0b601
--- /dev/null
+++ b/java/res/drawable-hdpi/keyboard_key_feedback_more_background.9.png
Binary files differ
diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_background.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_background.9.png
new file mode 100644
index 0000000..2a80f09
--- /dev/null
+++ b/java/res/drawable-mdpi/keyboard_key_feedback_background.9.png
Binary files differ
diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_more_background.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_more_background.9.png
new file mode 100755
index 0000000..29aa285
--- /dev/null
+++ b/java/res/drawable-mdpi/keyboard_key_feedback_more_background.9.png
Binary files differ
diff --git a/java/res/drawable/keyboard_key_feedback.xml b/java/res/drawable/keyboard_key_feedback.xml
new file mode 100644
index 0000000..159ba86
--- /dev/null
+++ b/java/res/drawable/keyboard_key_feedback.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_long_pressable="true"
+            android:drawable="@drawable/keyboard_key_feedback_more_background" />
+
+    <item android:drawable="@drawable/keyboard_key_feedback_background" />
+</selector>
diff --git a/java/res/layout/input.xml b/java/res/layout/input.xml
index 1d7c6f7..039fdd8 100755
--- a/java/res/layout/input.xml
+++ b/java/res/layout/input.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/keyboard_background"
-        android:keyBackground="@drawable/btn_keyboard_key"
+
+        latin:keyBackground="@drawable/btn_keyboard_key"
         />
diff --git a/java/res/layout/input2.xml b/java/res/layout/input2.xml
index 2e90c2c..3c9ec2f 100755
--- a/java/res/layout/input2.xml
+++ b/java/res/layout/input2.xml
@@ -20,10 +20,13 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key3"
         android:background="@android:color/black"
+
+        latin:keyBackground="@drawable/btn_keyboard_key3"
         />
diff --git a/java/res/layout/input3.xml b/java/res/layout/input3.xml
index a27d09a..a4295f7 100755
--- a/java/res/layout/input3.xml
+++ b/java/res/layout/input3.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key2"
         android:background="@drawable/keyboard_background_4"
+
+        latin:keyBackground="@drawable/btn_keyboard_key2"
         />
diff --git a/java/res/layout/input4.xml b/java/res/layout/input4.xml
index 58dd51e..b5da9d4 100755
--- a/java/res/layout/input4.xml
+++ b/java/res/layout/input4.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key3"
         android:background="@drawable/keyboard_background_4"
+
+        latin:keyBackground="@drawable/btn_keyboard_key3"
         />
diff --git a/java/res/layout/input5.xml b/java/res/layout/input5.xml
index 5cd0b8d..2de11df 100755
--- a/java/res/layout/input5.xml
+++ b/java/res/layout/input5.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key2"
         android:background="@drawable/keyboard_background_5"
+
+        latin:keyBackground="@drawable/btn_keyboard_key2"
         />
diff --git a/java/res/layout/input6.xml b/java/res/layout/input6.xml
index 19197e1..54f3104 100755
--- a/java/res/layout/input6.xml
+++ b/java/res/layout/input6.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key3"
         android:background="@drawable/keyboard_background_5"
+
+        latin:keyBackground="@drawable/btn_keyboard_key3"
         />
diff --git a/java/res/layout/input7.xml b/java/res/layout/input7.xml
index 6279f5d..1290eb8 100755
--- a/java/res/layout/input7.xml
+++ b/java/res/layout/input7.xml
@@ -20,14 +20,16 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@android:id/keyboardView"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        android:id="@+id/LatinkeyboardBaseView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/keyboard_background"
-        android:keyBackground="@drawable/btn_keyboard_key_ginger"
-        android:keyTextSize="22dip"
-        android:keyTextColor="@color/latinkeyboard_key_color_black"
-        android:shadowColor="@color/latinkeyboard_key_color_white"
-        android:popupLayout="@layout/input7_popup"
+
+        latin:keyBackground="@drawable/btn_keyboard_key_ginger"
+        latin:keyTextSize="22dip"
+        latin:keyTextColor="@color/latinkeyboard_key_color_black"
+        latin:shadowColor="@color/latinkeyboard_key_color_white"
+        latin:popupLayout="@layout/input7_popup"
         />
diff --git a/java/res/layout/input7_popup.xml b/java/res/layout/input7_popup.xml
index d1261b8..2056757 100755
--- a/java/res/layout/input7_popup.xml
+++ b/java/res/layout/input7_popup.xml
@@ -25,18 +25,20 @@
         android:orientation="horizontal"
         android:background="@drawable/keyboard_popup_panel_background"
         >
-    <android.inputmethodservice.KeyboardView
+    <com.android.inputmethod.latin.LatinKeyboardView
             xmlns:android="http://schemas.android.com/apk/res/android"
+            xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
             android:id="@android:id/keyboardView"
             android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:keyBackground="@drawable/btn_keyboard_key_ginger"
             android:background="@drawable/keyboard_background"
-            android:keyTextColor="@color/latinkeyboard_key_color_black"
-            android:shadowColor="@color/latinkeyboard_key_color_white"
-            android:keyTextSize="22dip"
-            android:popupLayout="@layout/input7_popup"
+
+            latin:keyBackground="@drawable/btn_keyboard_key_ginger"
+            latin:keyTextColor="@color/latinkeyboard_key_color_black"
+            latin:shadowColor="@color/latinkeyboard_key_color_white"
+            latin:keyTextSize="22dip"
+            latin:popupLayout="@layout/input7_popup"
         />
     <ImageButton android:id="@android:id/closeButton"
         android:background="@android:color/transparent"
diff --git a/java/res/layout/input_trans.xml b/java/res/layout/input_trans.xml
index f66e8cd..ee5f85e 100755
--- a/java/res/layout/input_trans.xml
+++ b/java/res/layout/input_trans.xml
@@ -20,11 +20,13 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/latinkeyboard_extension_background"
         android:verticalCorrection="0dip"
-        android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
+
+        latin:keyBackground="@drawable/btn_keyboard_key_fulltrans"
         />
diff --git a/java/res/layout/keyboard_key_preview.xml b/java/res/layout/keyboard_key_preview.xml
new file mode 100644
index 0000000..64eaa65
--- /dev/null
+++ b/java/res/layout/keyboard_key_preview.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="80sp"
+    android:textSize="40sp"
+    android:textColor="?android:attr/textColorPrimaryInverse"
+    android:minWidth="32dip"
+    android:gravity="center"
+    android:background="@drawable/keyboard_key_feedback"
+    />
diff --git a/java/res/layout/keyboard_popup_keyboard.xml b/java/res/layout/keyboard_popup_keyboard.xml
new file mode 100644
index 0000000..e6b3a41
--- /dev/null
+++ b/java/res/layout/keyboard_popup_keyboard.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:background="@drawable/keyboard_popup_panel_background"
+        >
+    <com.android.inputmethod.latin.LatinKeyboardBaseView
+            xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+            android:id="@+id/LatinKeyboardBaseView"
+            android:layout_alignParentBottom="true"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@android:color/transparent"
+
+            latin:keyPreviewLayout="@layout/keyboard_key_preview"
+            latin:keyTextSize="22sp"
+            latin:popupLayout="@layout/keyboard_popup_keyboard"
+            />
+    <ImageButton android:id="@+id/closeButton"
+        android:background="@android:color/transparent"
+        android:src="@drawable/btn_close"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginLeft="8dp"
+        android:clickable="true"
+        />
+</LinearLayout>
\ No newline at end of file
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
new file mode 100644
index 0000000..2468e9d
--- /dev/null
+++ b/java/res/values/attrs.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+
+    <declare-styleable name="LatinKeyboardBaseView">
+        <!-- Default KeyboardView style. -->
+        <attr name="keyboardViewStyle" format="reference" />
+
+        <!-- Image for the key. This image needs to be a StateListDrawable, with the following
+             possible states: normal, pressed, checkable, checkable+pressed, checkable+checked,
+             checkable+checked+pressed. -->
+        <attr name="keyBackground" format="reference" />
+
+        <!-- Size of the text for character keys. -->
+        <attr name="keyTextSize" format="dimension" />
+
+        <!-- Size of the text for custom keys with some text and no icon. -->
+        <attr name="labelTextSize" format="dimension" />
+
+        <!-- Color to use for the label in a key. -->
+        <attr name="keyTextColor" format="color" />
+
+        <!-- Layout resource for key press feedback.-->
+        <attr name="keyPreviewLayout" format="reference" />
+
+        <!-- Vertical offset of the key press feedback from the key. -->
+        <attr name="keyPreviewOffset" format="dimension" />
+
+        <!-- Height of the key press feedback popup. -->
+        <attr name="keyPreviewHeight" format="dimension" />
+
+        <!-- Amount to offset the touch Y coordinate by, for bias correction. -->
+        <attr name="verticalCorrection" format="dimension" />
+
+        <!-- Layout resource for popup keyboards. -->
+        <attr name="popupLayout" format="reference" />
+
+        <attr name="shadowColor" format="color" />
+        <attr name="shadowRadius" format="float" />
+        <attr name="backgroundDimAmount" format="float" />
+    </declare-styleable>
+
+</resources>
diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml
index ebe2f04..a0cebbb 100644
--- a/java/res/values/bools.xml
+++ b/java/res/values/bools.xml
@@ -25,4 +25,5 @@
     <bool name="im_is_default">false</bool>
     <!-- Whether or not voice input is enabled by default. -->
     <bool name="voice_input_default">true</bool>
+    <bool name="config_swipeDisambiguation">true</bool>
 </resources>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
new file mode 100644
index 0000000..a59a150
--- /dev/null
+++ b/java/res/values/styles.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <style name="LatinKeyboardBaseView">
+        <item name="android:background">@drawable/keyboard_background</item>
+
+        <item name="keyBackground">@drawable/btn_keyboard_key</item>
+        <item name="keyTextSize">22sp</item>
+        <item name="keyTextColor">#FFFFFFFF</item>
+        <item name="keyPreviewLayout">@layout/keyboard_key_preview</item>
+        <item name="keyPreviewOffset">-12dip</item>
+        <item name="keyPreviewHeight">80dip</item>
+        <item name="labelTextSize">14sp</item>
+        <item name="popupLayout">@layout/keyboard_popup_keyboard</item>
+        <item name="verticalCorrection">-10dip</item>
+        <item name="shadowColor">#BB000000</item>
+        <item name="shadowRadius">2.75</item>
+        <item name="backgroundDimAmount">0.5</item>
+    </style>
+</resources>