Merge "Refactor UI message handling class to be more readable"
diff --git a/java/Android.mk b/java/Android.mk
index c89e1c6..0d5a93d 100755
--- a/java/Android.mk
+++ b/java/Android.mk
@@ -23,4 +23,11 @@
 
 LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.flags
 
+# Define LOCAL_DICTIONARY_RESOURCE_DIR in order to overlay dictionaries.
+# The overlay dictionary resource directory should have dictionary files such
+# as raw-en/main.dict, raw-es/main.dict per locale.
+ifneq ($(strip $(LOCAL_DICTIONARY_RESOURCE_DIR)),)
+LOCAL_RESOURCE_DIR := $(LOCAL_DICTIONARY_RESOURCE_DIR) $(LOCAL_PATH)/res
+endif
+
 include $(BUILD_PACKAGE)
diff --git a/java/res/drawable/btn_keyboard_key_normal_off_ginger.9.png b/java/res/drawable/btn_keyboard_key_normal_off_stone.9.png
similarity index 100%
rename from java/res/drawable/btn_keyboard_key_normal_off_ginger.9.png
rename to java/res/drawable/btn_keyboard_key_normal_off_stone.9.png
Binary files differ
diff --git a/java/res/drawable/btn_keyboard_key_normal_on_ginger.9.png b/java/res/drawable/btn_keyboard_key_normal_on_stone.9.png
similarity index 100%
rename from java/res/drawable/btn_keyboard_key_normal_on_ginger.9.png
rename to java/res/drawable/btn_keyboard_key_normal_on_stone.9.png
Binary files differ
diff --git a/java/res/drawable/btn_keyboard_key_normal_ginger.9.png b/java/res/drawable/btn_keyboard_key_normal_stone.9.png
similarity index 100%
rename from java/res/drawable/btn_keyboard_key_normal_ginger.9.png
rename to java/res/drawable/btn_keyboard_key_normal_stone.9.png
Binary files differ
diff --git a/java/res/drawable/btn_keyboard_key_ginger.xml b/java/res/drawable/btn_keyboard_key_stone.xml
similarity index 92%
rename from java/res/drawable/btn_keyboard_key_ginger.xml
rename to java/res/drawable/btn_keyboard_key_stone.xml
index 7477037..a6040a0 100644
--- a/java/res/drawable/btn_keyboard_key_ginger.xml
+++ b/java/res/drawable/btn_keyboard_key_stone.xml
@@ -20,17 +20,17 @@
 
     <item android:state_checkable="true" android:state_checked="true"
           android:state_pressed="true"
-          android:drawable="@drawable/btn_keyboard_key_normal_on_ginger" />
+          android:drawable="@drawable/btn_keyboard_key_normal_on_stone" />
     <item android:state_checkable="true" android:state_pressed="true"
-          android:drawable="@drawable/btn_keyboard_key_normal_off_ginger" />
+          android:drawable="@drawable/btn_keyboard_key_normal_off_stone" />
     <item android:state_checkable="true" android:state_checked="true"
-          android:drawable="@drawable/btn_keyboard_key_normal_on_ginger" />
+          android:drawable="@drawable/btn_keyboard_key_normal_on_stone" />
     <item android:state_checkable="true"
-          android:drawable="@drawable/btn_keyboard_key_normal_off_ginger" />
+          android:drawable="@drawable/btn_keyboard_key_normal_off_stone" />
 
     <!-- Normal keys -->
 
     <item android:state_pressed="true"
           android:drawable="@drawable/btn_keyboard_key_fulltrans_pressed" />
-    <item android:drawable="@drawable/btn_keyboard_key_normal_ginger" />
+    <item android:drawable="@drawable/btn_keyboard_key_normal_stone" />
 </selector>
diff --git a/java/res/layout-xlarge/input.xml b/java/res/layout-xlarge/input.xml
deleted file mode 100644
index 6b0bb12..0000000
--- a/java/res/layout-xlarge/input.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
-*/
--->
-
-<com.android.inputmethod.latin.LatinKeyboardView
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        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"
-        android:keyTextSize="32sp"
-        android:verticalCorrection="0dip"
-        />
diff --git a/java/res/layout-xlarge/input_trans.xml b/java/res/layout-xlarge/input_trans.xml
deleted file mode 100755
index 1dfdc15..0000000
--- a/java/res/layout-xlarge/input_trans.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
-*/
--->
-
-<com.android.inputmethod.latin.LatinKeyboardView
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        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:keyTextSize="32sp"
-        android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
-        />
diff --git a/java/res/layout/input_stone_bold.xml b/java/res/layout/input_stone_bold.xml
index 8cc082b..d6c03cc 100755
--- a/java/res/layout/input_stone_bold.xml
+++ b/java/res/layout/input_stone_bold.xml
@@ -28,8 +28,7 @@
         android:background="@drawable/keyboard_background"
         android:textStyle="bold"
 
-        latin:keyBackground="@drawable/btn_keyboard_key_ginger"
-        latin:keyTextSize="22dip"
+        latin:keyBackground="@drawable/btn_keyboard_key_stone"
         latin:keyTextColor="@color/latinkeyboard_key_color_black"
         latin:shadowColor="@color/latinkeyboard_key_color_white"
         latin:keyTextStyle="bold"
diff --git a/java/res/layout/input_stone_normal.xml b/java/res/layout/input_stone_normal.xml
index 5169350..2c39bb1 100755
--- a/java/res/layout/input_stone_normal.xml
+++ b/java/res/layout/input_stone_normal.xml
@@ -27,8 +27,7 @@
         android:layout_height="wrap_content"
         android:background="@drawable/keyboard_background"
 
-        latin:keyBackground="@drawable/btn_keyboard_key_ginger"
-        latin:keyTextSize="22dip"
+        latin:keyBackground="@drawable/btn_keyboard_key_stone"
         latin:keyTextColor="@color/latinkeyboard_key_color_black"
         latin:shadowColor="@color/latinkeyboard_key_color_white"
         latin:symbolColorScheme="black"
diff --git a/java/res/layout/input_stone_popup.xml b/java/res/layout/input_stone_popup.xml
index e6eae5d..b6894b6 100755
--- a/java/res/layout/input_stone_popup.xml
+++ b/java/res/layout/input_stone_popup.xml
@@ -33,10 +33,9 @@
             android:layout_height="wrap_content"
             android:background="@drawable/keyboard_background"
 
-            latin:keyBackground="@drawable/btn_keyboard_key_ginger"
+            latin:keyBackground="@drawable/btn_keyboard_key_stone"
             latin:keyTextColor="@color/latinkeyboard_key_color_black"
             latin:shadowColor="@color/latinkeyboard_key_color_white"
-            latin:keyTextSize="22dip"
             latin:popupLayout="@layout/input_stone_popup"
         />
     <ImageButton android:id="@+id/closeButton"
@@ -48,4 +47,4 @@
         android:layout_marginLeft="8dp"
         android:clickable="true"
         />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/java/res/layout/keyboard_popup_keyboard.xml b/java/res/layout/keyboard_popup_keyboard.xml
index e6b3a41..5f8a03d 100644
--- a/java/res/layout/keyboard_popup_keyboard.xml
+++ b/java/res/layout/keyboard_popup_keyboard.xml
@@ -33,7 +33,6 @@
             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"
@@ -45,4 +44,4 @@
         android:layout_marginLeft="8dp"
         android:clickable="true"
         />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/java/res/values-xlarge/styles.xml b/java/res/values-xlarge/styles.xml
new file mode 100644
index 0000000..1772da3
--- /dev/null
+++ b/java/res/values-xlarge/styles.xml
@@ -0,0 +1,35 @@
+<?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">32sp</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>
+        <item name="symbolColorScheme">white</item>
+    </style>
+</resources>
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index bbde232..95068e6 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -129,6 +129,9 @@
     }
 
     void makeKeyboards(boolean forceCreate) {
+        mSymbolsId = makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
+        mSymbolsShiftedId = makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
+
         if (forceCreate) mKeyboards.clear();
         // Configuration change is coming after the keyboard gets recreated. So don't rely on that.
         // If keyboards have already been made, check if we have a screen width change and 
@@ -137,8 +140,6 @@
         if (displayWidth == mLastDisplayWidth) return;
         mLastDisplayWidth = displayWidth;
         if (!forceCreate) mKeyboards.clear();
-        mSymbolsId = makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
-        mSymbolsShiftedId = makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
     }
 
     /**
@@ -338,7 +339,7 @@
             LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
             symbolsShiftedKeyboard.setShifted(false);
             mCurrentId = mSymbolsId;
-            mInputView.setKeyboard(getKeyboard(mSymbolsId));
+            mInputView.setKeyboard(symbolsKeyboard);
             symbolsKeyboard.setShifted(false);
             symbolsKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions);
         }