Merge "Import revised translations."
diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_background_holo.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_background_holo.9.png
index 943f9e4..8d6acac 100644
--- a/java/res/drawable-hdpi/keyboard_key_feedback_background_holo.9.png
+++ b/java/res/drawable-hdpi/keyboard_key_feedback_background_holo.9.png
Binary files differ
diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_background_holo.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_background_holo.9.png
index a7acb4a..286cf84 100644
--- a/java/res/drawable-mdpi/keyboard_key_feedback_background_holo.9.png
+++ b/java/res/drawable-mdpi/keyboard_key_feedback_background_holo.9.png
Binary files differ
diff --git a/java/res/drawable/keyboard_key_feedback_honeycomb.xml b/java/res/drawable/keyboard_key_feedback_honeycomb.xml
index dd9b53e..a3ea140 100644
--- a/java/res/drawable/keyboard_key_feedback_honeycomb.xml
+++ b/java/res/drawable/keyboard_key_feedback_honeycomb.xml
@@ -16,6 +16,6 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
     <item android:state_long_pressable="true"
-            android:drawable="@drawable/keyboard_key_feedback_more_background" />
+            android:drawable="@drawable/keyboard_key_feedback_more_background_holo" />
     <item android:drawable="@drawable/keyboard_key_feedback_background_holo" />
 </selector>
diff --git a/java/res/layout-xlarge/keyboard_popup_honeycomb.xml b/java/res/layout-xlarge/keyboard_popup_honeycomb.xml
deleted file mode 100644
index 0b8229c..0000000
--- a/java/res/layout-xlarge/keyboard_popup_honeycomb.xml
+++ /dev/null
@@ -1,41 +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.
-*/
--->
-<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_holo"
-        android:paddingLeft="40dip"
-        android:paddingRight="40dip"
-        >
-    <com.android.inputmethod.keyboard.KeyboardView
-            xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
-            android:id="@+id/KeyboardView"
-            android:layout_alignParentBottom="true"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="@color/latinkeyboard_transparent"
-
-            latin:keyBackground="@drawable/btn_keyboard_key_honeycomb_popup"
-            latin:keyHysteresisDistance="0dip"
-            latin:verticalCorrection="@dimen/mini_keyboard_vertical_correction"
-            />
-</LinearLayout>
diff --git a/java/res/layout/input_honeycomb.xml b/java/res/layout/input_honeycomb.xml
index 6ccc63c..96b10b7 100644
--- a/java/res/layout/input_honeycomb.xml
+++ b/java/res/layout/input_honeycomb.xml
@@ -31,6 +31,8 @@
 
         latin:keyBackground="@drawable/btn_keyboard_key_honeycomb"
         latin:keyPreviewLayout="@layout/key_preview_honeycomb"
+        latin:keyPreviewHeight="@dimen/key_preview_height_holo"
+        latin:keyPreviewOffset="@dimen/key_preview_offset_holo"
         latin:popupLayout="@layout/keyboard_popup_honeycomb"
         latin:keyTextColorDisabled="#FF63666D"
         latin:keyLetterStyle="bold"
diff --git a/java/res/layout/key_preview_honeycomb.xml b/java/res/layout/key_preview_honeycomb.xml
index a90fe55..2fbfbb5 100644
--- a/java/res/layout/key_preview_honeycomb.xml
+++ b/java/res/layout/key_preview_honeycomb.xml
@@ -23,7 +23,7 @@
     android:layout_height="80sp"
     android:textSize="40sp"
     android:textColor="@color/latinkeyboard_key_color_white"
-    android:minWidth="24dip"
+    android:minWidth="32dip"
     android:gravity="center"
     android:background="@drawable/keyboard_key_feedback_honeycomb"
     />
diff --git a/java/res/layout/keyboard_popup.xml b/java/res/layout/keyboard_popup.xml
index ac8134b..0136622 100644
--- a/java/res/layout/keyboard_popup.xml
+++ b/java/res/layout/keyboard_popup.xml
@@ -19,20 +19,19 @@
 -->
 <LinearLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
         android:background="@drawable/keyboard_popup_panel_background"
-        android:paddingLeft="16dip"
-        android:paddingRight="16dip"
+        android:paddingLeft="@dimen/mini_keyboard_horizontal_padding"
+        android:paddingRight="@dimen/mini_keyboard_horizontal_padding"
         >
     <com.android.inputmethod.keyboard.KeyboardView
             xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
             android:id="@+id/KeyboardView"
             android:layout_alignParentBottom="true"
-            android:layout_width="match_parent"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:background="@color/latinkeyboard_transparent"
 
             latin:keyBackground="@drawable/btn_keyboard_key_gingerbread_popup"
             latin:keyHysteresisDistance="0dip"
diff --git a/java/res/layout/keyboard_popup_honeycomb.xml b/java/res/layout/keyboard_popup_honeycomb.xml
index e5fcbd4..96c519d 100644
--- a/java/res/layout/keyboard_popup_honeycomb.xml
+++ b/java/res/layout/keyboard_popup_honeycomb.xml
@@ -19,20 +19,19 @@
 -->
 <LinearLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
         android:background="@drawable/keyboard_popup_panel_background_holo"
-        android:paddingLeft="24dip"
-        android:paddingRight="24dip"
+        android:paddingLeft="@dimen/mini_keyboard_horizontal_padding_holo"
+        android:paddingRight="@dimen/mini_keyboard_horizontal_padding_holo"
         >
     <com.android.inputmethod.keyboard.KeyboardView
             xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
             android:id="@+id/KeyboardView"
             android:layout_alignParentBottom="true"
-            android:layout_width="match_parent"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:background="@color/latinkeyboard_transparent"
 
             latin:keyBackground="@drawable/btn_keyboard_key_honeycomb_popup"
             latin:keyHysteresisDistance="0dip"
diff --git a/java/res/values-xlarge-land/dimens.xml b/java/res/values-xlarge-land/dimens.xml
index 625dd26..ba42ddd 100644
--- a/java/res/values-xlarge-land/dimens.xml
+++ b/java/res/values-xlarge-land/dimens.xml
@@ -19,7 +19,7 @@
 -->
 
 <resources>
-    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
+    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=14.5mm -->
     <dimen name="keyboardHeight">58.0mm</dimen>
     <!-- key_height + key_bottom_gap = popup_key_height -->
     <!-- <dimen name="key_height">14.5mm</dimen> -->
@@ -28,12 +28,13 @@
     <dimen name="popup_key_height">13.0mm</dimen>
     <dimen name="keyboard_top_padding">1.1mm</dimen>
     <dimen name="keyboard_bottom_padding">0.0mm</dimen>
-    <!-- key_height x 1.0 -->
-    <dimen name="key_preview_height">13.0mm</dimen>
 
     <dimen name="key_letter_size">28dip</dimen>
     <dimen name="key_label_text_size">20dip</dimen>
     <!-- left or right padding of label alignment -->
     <dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
+    <dimen name="key_preview_height_holo">26.5mm</dimen>
+    <dimen name="key_preview_offset_holo">7.5mm</dimen>
+
     <dimen name="candidate_strip_padding">40.0mm</dimen>
 </resources>
diff --git a/java/res/values-xlarge/config.xml b/java/res/values-xlarge/config.xml
index f075b1b..ed8dc3e 100644
--- a/java/res/values-xlarge/config.xml
+++ b/java/res/values-xlarge/config.xml
@@ -22,7 +22,8 @@
     <bool name="config_enable_show_settings_key_option">false</bool>
     <bool name="config_enable_show_subtype_settings">false</bool>
     <bool name="config_enable_show_voice_key_option">false</bool>
-    <bool name="config_enable_show_popup_on_keypress_option">false</bool>
+    <!-- TODO: This configuration value is temporary set true to check popup preview behavior. -->
+    <bool name="config_enable_show_popup_on_keypress_option">true</bool>
     <bool name="config_enable_show_recorrection_option">false</bool>
     <bool name="config_enable_quick_fixes_option">false</bool>
     <bool name="config_enable_bigram_suggestions_option">false</bool>
diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml
index 6928320..cdb6e89 100644
--- a/java/res/values-xlarge/dimens.xml
+++ b/java/res/values-xlarge/dimens.xml
@@ -19,7 +19,7 @@
 -->
 
 <resources>
-    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
+    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=12mm -->
     <dimen name="keyboardHeight">48.0mm</dimen>
     <!-- key_height + key_bottom_gap = popup_key_height -->
     <!-- <dimen name="key_height">14.5mm</dimen> -->
@@ -28,8 +28,7 @@
     <dimen name="popup_key_height">10.0mm</dimen>
     <dimen name="keyboard_top_padding">1.1mm</dimen>
     <dimen name="keyboard_bottom_padding">0.0mm</dimen>
-    <!-- key_height x 1.0 -->
-    <dimen name="key_preview_height">13.0mm</dimen>
+    <dimen name="mini_keyboard_horizontal_padding_holo">40dip</dimen>
     <dimen name="mini_keyboard_key_horizontal_padding">12dip</dimen>
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
     <!-- popup_key_height x 1.2 -->
@@ -39,9 +38,11 @@
 
     <dimen name="key_letter_size">26dip</dimen>
     <dimen name="key_label_text_size">16dip</dimen>
-    <dimen name="key_preview_text_size_large">24dip</dimen>
     <!-- left or right padding of label alignment -->
     <dimen name="key_label_horizontal_alignment_padding">6dip</dimen>
+    <dimen name="key_preview_text_size_large">24dip</dimen>
+    <dimen name="key_preview_height_holo">23.0mm</dimen>
+    <dimen name="key_preview_offset_holo">8.0mm</dimen>
 
     <dimen name="candidate_strip_height">46dip</dimen>
     <dimen name="candidate_strip_padding">15.0mm</dimen>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index f0da274..28c948b 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -107,8 +107,8 @@
             <!-- Key is anchored to the right of the keyboard. -->
             <flag name="right" value="2" />
         </attr>
-        <!-- Whether this is a modifier key such as Alt or Shift. -->
-        <attr name="isModifier" format="boolean" />
+        <!-- Whether this is a functional key which has different key top than normal key. -->
+        <attr name="isFunctional" format="boolean" />
         <!-- Whether this is a toggle key. -->
         <attr name="isSticky" format="boolean" />
         <!-- Whether long-pressing on this key will make it repeat. -->
diff --git a/java/res/values/colors.xml b/java/res/values/colors.xml
index 0161589..5e9d632 100644
--- a/java/res/values/colors.xml
+++ b/java/res/values/colors.xml
@@ -21,7 +21,6 @@
     <color name="candidate_normal">#FFFFFFFF</color>
     <color name="candidate_recommended">#FFFCAE00</color>
     <color name="candidate_other">#FFFCAE00</color>
-    <color name="latinkeyboard_transparent">#00000000</color>
     <color name="latinkeyboard_bar_language_shadow_white">#80000000</color>
     <color name="latinkeyboard_bar_language_shadow_black">#80FFFFFF</color>
     <color name="latinkeyboard_bar_language_text">#FFC0C0C0</color>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 7f00cdb..2cfc17d 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -19,7 +19,7 @@
 -->
 
 <resources>
-    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
+    <!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.290in -->
     <dimen name="keyboardHeight">1.265in</dimen>
     <!-- key_height + key_bottom_gap = popup_key_height -->
     <!-- <dimen name="key_height">0.290in</dimen> -->
@@ -28,25 +28,28 @@
     <dimen name="popup_key_height">0.325in</dimen>
     <dimen name="keyboard_top_padding">0.00in</dimen>
     <dimen name="keyboard_bottom_padding">0.06in</dimen>
-    <!-- key_preview_text_size_large x 2 -->
-    <dimen name="key_preview_height">80sp</dimen>
+    <dimen name="mini_keyboard_horizontal_padding">16dip</dimen>
+    <dimen name="mini_keyboard_horizontal_padding_holo">32dip</dimen>
     <dimen name="mini_keyboard_key_horizontal_padding">8dip</dimen>
     <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
     <!-- popup_key_height x 1.2 -->
     <dimen name="mini_keyboard_slide_allowance">0.390in</dimen>
     <!-- popup_key_height x -1.0 -->
     <dimen name="mini_keyboard_vertical_correction">-0.325in</dimen>
-
-    <dimen name="key_letter_size">0.13in</dimen>
-    <dimen name="key_label_text_size">0.083in</dimen>
-    <dimen name="key_preview_text_size_large">40sp</dimen>
-    <!-- left or right padding of label alignment -->
-    <dimen name="key_label_horizontal_alignment_padding">0.13in</dimen>
-    <dimen name="key_preview_offset">0.000in</dimen>
     <!-- We use "inch", not "dip" because this value tries dealing with physical distance related
          to user's finger. -->
     <dimen name="keyboard_vertical_correction">-0.05in</dimen>
 
+    <dimen name="key_letter_size">0.13in</dimen>
+    <dimen name="key_label_text_size">0.083in</dimen>
+    <!-- left or right padding of label alignment -->
+    <dimen name="key_label_horizontal_alignment_padding">0.13in</dimen>
+    <dimen name="key_preview_height">80sp</dimen>
+    <dimen name="key_preview_offset">0.000in</dimen>
+    <dimen name="key_preview_text_size_large">36sp</dimen>
+    <dimen name="key_preview_height_holo">130sp</dimen>
+    <dimen name="key_preview_offset_holo">0.193in</dimen>
+
     <dimen name="candidate_strip_height">42dip</dimen>
     <dimen name="candidate_strip_fading_edge_length">63dip</dimen>
     <dimen name="candidate_strip_padding">0dip</dimen>
diff --git a/java/res/xml-xlarge/kbd_key_styles.xml b/java/res/xml-xlarge/kbd_key_styles.xml
index fc06d00..4fefe00 100644
--- a/java/res/xml-xlarge/kbd_key_styles.xml
+++ b/java/res/xml-xlarge/kbd_key_styles.xml
@@ -28,7 +28,7 @@
         >
             <key-style
                 latin:styleName="functionalKeyStyle"
-                latin:isModifier="true" />
+                latin:isFunctional="true" />
             <key-style
                 latin:styleName="shiftKeyStyle"
                 latin:code="@integer/key_shift"
diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml
index 473510e..ea5d4cc 100644
--- a/java/res/xml/kbd_key_styles.xml
+++ b/java/res/xml/kbd_key_styles.xml
@@ -28,7 +28,7 @@
         >
             <key-style
                 latin:styleName="functionalKeyStyle"
-                latin:isModifier="true" />
+                latin:isFunctional="true" />
             <key-style
                 latin:styleName="shiftKeyStyle"
                 latin:code="@integer/key_shift"
diff --git a/java/res/xml/kbd_qwerty_black_symbol.xml b/java/res/xml/kbd_qwerty_black_symbol.xml
index 6e45c12..69e7e31 100644
--- a/java/res/xml/kbd_qwerty_black_symbol.xml
+++ b/java/res/xml/kbd_qwerty_black_symbol.xml
@@ -38,7 +38,7 @@
                         latin:keyIcon="@drawable/sym_bkeyboard_123_mic"
                         latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
                         latin:keyWidth="20%p"
-                        latin:isModifier="true"
+                        latin:isFunctional="true"
                         latin:keyEdgeFlags="left" />
                 </case>
                 <default>
@@ -46,7 +46,7 @@
                         latin:code="@integer/key_switch_alpha_symbol"
                         latin:keyLabel="@string/label_to_symbol_key"
                         latin:keyWidth="20%p"
-                        latin:isModifier="true"
+                        latin:isFunctional="true"
                         latin:keyEdgeFlags="left" />
                 </default>
             </switch>
@@ -67,7 +67,7 @@
                         latin:keyIcon="@drawable/sym_bkeyboard_123_mic"
                         latin:iconPreview="@drawable/sym_keyboard_feedback_123_mic"
                         latin:keyWidth="15%p"
-                        latin:isModifier="true"
+                        latin:isFunctional="true"
                         latin:keyEdgeFlags="left" />
                 </case>
                 <default>
@@ -75,7 +75,7 @@
                         latin:code="@integer/key_switch_alpha_symbol"
                         latin:keyLabel="@string/label_to_symbol_key"
                         latin:keyWidth="15%p"
-                        latin:isModifier="true"
+                        latin:isFunctional="true"
                         latin:keyEdgeFlags="left" />
                 </default>
             </switch>
diff --git a/java/res/xml/kbd_qwerty_f1.xml b/java/res/xml/kbd_qwerty_f1.xml
index cbdb8c0..008448b 100644
--- a/java/res/xml/kbd_qwerty_f1.xml
+++ b/java/res/xml/kbd_qwerty_f1.xml
@@ -29,7 +29,7 @@
                 latin:keyLabel="/"
                 latin:keyHintIcon="@drawable/hint_popup"
                 latin:popupCharacters="@string/alternates_for_settings_slash"
-                latin:isModifier="true" />
+                latin:isFunctional="true" />
         </case>
         <case
             latin:mode="email"
@@ -38,7 +38,7 @@
                 latin:keyLabel="\@"
                 latin:keyHintIcon="@drawable/hint_popup"
                 latin:popupCharacters="@string/alternates_for_settings_at"
-                latin:isModifier="true" />
+                latin:isFunctional="true" />
         </case>
         <default>
             <switch>
@@ -51,11 +51,24 @@
                 <case
                     latin:hasVoiceKey="false"
                 >
-                    <Key
-                        latin:keyLabel=","
-                        latin:keyHintIcon="@drawable/hint_popup"
-                        latin:popupCharacters="@string/alternates_for_settings_comma"
-                        latin:isModifier="true" />
+                    <switch>
+                        <case
+                            latin:hasSettingsKey="true"
+                        >
+                            <Key
+                                latin:keyLabel=","
+                                latin:isFunctional="true" />
+                        </case>
+                        <case
+                            latin:hasSettingsKey="false"
+                        >
+                            <Key
+                                latin:keyLabel=","
+                                latin:keyHintIcon="@drawable/hint_popup"
+                                latin:popupCharacters="@string/alternates_for_settings_comma"
+                                latin:isFunctional="true" />
+                        </case>
+                    </switch>
                 </case>
             </switch>
         </default>
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 7396f05..f578bd6 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -83,8 +83,8 @@
      * {@link Keyboard#EDGE_TOP} and {@link Keyboard#EDGE_BOTTOM}.
      */
     public final int mEdgeFlags;
-    /** Whether this is a modifier key, such as Shift or Alt */
-    public final boolean mModifier;
+    /** Whether this is a functional key which has different key top than normal key */
+    public final boolean mFunctional;
     /** Whether this key repeats itself when held down */
     public final boolean mRepeatable;
 
@@ -93,8 +93,8 @@
 
     /** The current pressed state of this key */
     public boolean mPressed;
-    /** If this is a sticky key, is it on? */
-    public boolean mOn;
+    /** If this is a sticky key, is its highlight on? */
+    public boolean mHighlightOn;
     /** Key is enabled and responds on press */
     public boolean mEnabled = true;
 
@@ -150,7 +150,7 @@
         mManualTemporaryUpperCaseHintIcon = null;
         mManualTemporaryUpperCaseCode = Keyboard.CODE_DUMMY;
         mLabelOption = 0;
-        mModifier = false;
+        mFunctional = false;
         mSticky = false;
         mRepeatable = false;
         mPopupCharacters = null;
@@ -224,7 +224,7 @@
                     mKeyboard.getMaxPopupKeyboardColumn());
 
             mRepeatable = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable, false);
-            mModifier = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isModifier, false);
+            mFunctional = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional, false);
             mSticky = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky, false);
             mEnabled = style.getBoolean(keyAttr, R.styleable.Keyboard_Key_enabled, true);
             mEdgeFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyEdgeFlags, 0)
@@ -315,22 +315,19 @@
     /**
      * Informs the key that it has been pressed, in case it needs to change its appearance or
      * state.
-     * @see #onReleased(boolean)
+     * @see #onReleased()
      */
     public void onPressed() {
-        mPressed = !mPressed;
+        mPressed = true;
     }
 
     /**
-     * Changes the pressed state of the key. If it is a sticky key, it will also change the
-     * toggled state of the key if the finger was release inside.
-     * @param inside whether the finger was released inside the key
+     * Informs the key that it has been released, in case it needs to change its appearance or
+     * state.
      * @see #onPressed()
      */
-    public void onReleased(boolean inside) {
-        mPressed = !mPressed;
-        if (mSticky && !mKeyboard.isShiftLockEnabled(this))
-            mOn = !mOn;
+    public void onReleased() {
+        mPressed = false;
     }
 
     public boolean isInside(int x, int y) {
@@ -376,12 +373,6 @@
         return dx * dx + dy * dy;
     }
 
-    // sticky is used for shift key.  If a key is not sticky and is modifier,
-    // the key will be treated as functional.
-    private boolean isFunctionalKey() {
-        return !mSticky && mModifier;
-    }
-
     /**
      * Returns the drawable state for the key, based on the current state and type of the key.
      * @return the drawable state of the key.
@@ -389,7 +380,7 @@
      */
     public int[] getCurrentDrawableState() {
         final boolean pressed = mEnabled && mPressed;
-        if (isFunctionalKey()) {
+        if (!mSticky && mFunctional) {
             if (pressed) {
                 return KEY_STATE_FUNCTIONAL_PRESSED;
             } else {
@@ -399,7 +390,7 @@
 
         int[] states = KEY_STATE_NORMAL;
 
-        if (mOn) {
+        if (mHighlightOn) {
             if (pressed) {
                 states = KEY_STATE_PRESSED_ON;
             } else {
diff --git a/java/src/com/android/inputmethod/keyboard/KeyStyles.java b/java/src/com/android/inputmethod/keyboard/KeyStyles.java
index 169f2e6..d464c20 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyStyles.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyStyles.java
@@ -185,7 +185,7 @@
             readDrawable(keyAttr, R.styleable.Keyboard_Key_iconPreview);
             readDrawable(keyAttr, R.styleable.Keyboard_Key_keyHintIcon);
             readDrawable(keyAttr, R.styleable.Keyboard_Key_shiftedIcon);
-            readBoolean(keyAttr, R.styleable.Keyboard_Key_isModifier);
+            readBoolean(keyAttr, R.styleable.Keyboard_Key_isFunctional);
             readBoolean(keyAttr, R.styleable.Keyboard_Key_isSticky);
             readBoolean(keyAttr, R.styleable.Keyboard_Key_isRepeatable);
             readBoolean(keyAttr, R.styleable.Keyboard_Key_enabled);
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 06d4468..4181882 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -293,7 +293,7 @@
     public boolean setShiftLocked(boolean newShiftLockState) {
         final Map<Key, Drawable> shiftedIcons = getShiftedIcons();
         for (final Key key : getShiftKeys()) {
-            key.mOn = newShiftLockState;
+            key.mHighlightOn = newShiftLockState;
             key.setIcon(newShiftLockState ? shiftedIcons.get(key) : mNormalShiftIcons.get(key));
         }
         mShiftState.setShiftLocked(newShiftLockState);
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index cfa3c44..dd25b34 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -263,10 +263,10 @@
         int xmlId = mode == KeyboardId.MODE_PHONE ? R.xml.kbd_phone : R.xml.kbd_symbols;
         final String xmlName = res.getResourceEntryName(xmlId);
         mSymbolsId = new KeyboardId(xmlName, xmlId, colorScheme, locale, orientation, mode,
-                attribute, hasSettingsKey, mVoiceKeyEnabled, hasVoiceKey, true);
+                attribute, hasSettingsKey, mVoiceKeyEnabled, hasVoiceKey, false);
         xmlId = mode == KeyboardId.MODE_PHONE ? R.xml.kbd_phone_symbols : R.xml.kbd_symbols_shift;
         mSymbolsShiftedId = new KeyboardId(xmlName, xmlId, colorScheme, locale, orientation, mode,
-                attribute, hasSettingsKey, mVoiceKeyEnabled, hasVoiceKey, true);
+                attribute, hasSettingsKey, mVoiceKeyEnabled, hasVoiceKey, false);
     }
 
     public int getKeyboardMode() {
@@ -565,16 +565,14 @@
             mCurrentId = mSymbolsShiftedId;
             keyboard = getKeyboard(mCurrentId);
             // Symbol shifted keyboard has an ALT key that has a caps lock style indicator. To
-            // enable the indicator, we need to call enableShiftLock() and setShiftLocked(true).
-            // Thus we can keep the ALT key's Key.on value true while LatinKey.onRelease() is
-            // called.
+            // enable the indicator, we need to call setShiftLocked(true).
             keyboard.setShiftLocked(true);
         } else {
             mCurrentId = mSymbolsId;
             keyboard = getKeyboard(mCurrentId);
             // Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the
-            // indicator, we need to call enableShiftLock() and setShiftLocked(false).
-            keyboard.setShifted(false);
+            // indicator, we need to call setShiftLocked(false).
+            keyboard.setShiftLocked(false);
         }
         setKeyboard(keyboard);
     }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index 61af15b..cc14589 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -37,7 +37,6 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.SystemClock;
-import android.provider.Settings;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.TypedValue;
@@ -378,6 +377,7 @@
         }
         mPreviewPopup.setTouchable(false);
         mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation);
+        mPreviewPopup.setClippingEnabled(false);
         mDelayBeforePreview = res.getInteger(R.integer.config_delay_before_preview);
         mDelayAfterPreview = res.getInteger(R.integer.config_delay_after_preview);
         mKeyLabelHorizontalPadding = (int)res.getDimension(
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index 5820049..9b87df3 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -229,7 +229,7 @@
         final Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
         final Canvas canvas = new Canvas(buffer);
         final Resources res = mContext.getResources();
-        canvas.drawColor(res.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR);
+        canvas.drawColor(res.getColor(android.R.color.transparent), PorterDuff.Mode.CLEAR);
 
         SubtypeSwitcher subtypeSwitcher = SubtypeSwitcher.getInstance();
         // If application locales are explicitly selected.
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index 7468578..c281970 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -87,6 +87,9 @@
     // true if sliding key is allowed.
     private boolean mIsAllowedSlidingKeyInput;
 
+    // ignore modifier key if true
+    private boolean mIgnoreModifierKey;
+
     // pressed key
     private int mPreviousKey = NOT_A_KEY;
 
@@ -139,8 +142,12 @@
 
     // Returns true if keyboard has been changed by this callback.
     private boolean callListenerOnPressAndCheckKeyboardLayoutChange(Key key, boolean withSliding) {
+        final boolean ignoreModifierKey = mIgnoreModifierKey && isModifierCode(key.mCode);
         if (DEBUG_LISTENER)
-            Log.d(TAG, "onPress    : " + keyCodePrintable(key.mCode) + " sliding=" + withSliding);
+            Log.d(TAG, "onPress    : " + keyCodePrintable(key.mCode) + " sliding=" + withSliding
+                    + " ignoreModifier=" + ignoreModifierKey);
+        if (ignoreModifierKey)
+            return false;
         if (key.mEnabled) {
             mListener.onPress(key.mCode, withSliding);
             final boolean keyboardLayoutHasBeenChanged = mKeyboardLayoutHasBeenChanged;
@@ -153,9 +160,13 @@
     // Note that we need primaryCode argument because the keyboard may in shifted state and the
     // primaryCode is different from {@link Key#mCode}.
     private void callListenerOnCodeInput(Key key, int primaryCode, int[] keyCodes, int x, int y) {
+        final boolean ignoreModifierKey = mIgnoreModifierKey && isModifierCode(key.mCode);
         if (DEBUG_LISTENER)
             Log.d(TAG, "onCodeInput: " + keyCodePrintable(primaryCode)
-                    + " codes="+ Arrays.toString(keyCodes) + " x=" + x + " y=" + y);
+                    + " codes="+ Arrays.toString(keyCodes) + " x=" + x + " y=" + y
+                    + " ignoreModifier=" + ignoreModifierKey);
+        if (ignoreModifierKey)
+            return;
         if (key.mEnabled)
             mListener.onCodeInput(primaryCode, keyCodes, x, y);
     }
@@ -170,8 +181,12 @@
     // Note that we need primaryCode argument because the keyboard may in shifted state and the
     // primaryCode is different from {@link Key#mCode}.
     private void callListenerOnRelease(Key key, int primaryCode, boolean withSliding) {
+        final boolean ignoreModifierKey = mIgnoreModifierKey && isModifierCode(key.mCode);
         if (DEBUG_LISTENER)
-            Log.d(TAG, "onRelease  : " + keyCodePrintable(primaryCode) + " sliding=" + withSliding);
+            Log.d(TAG, "onRelease  : " + keyCodePrintable(primaryCode) + " sliding="
+                    + withSliding + " ignoreModifier=" + ignoreModifierKey);
+        if (ignoreModifierKey)
+            return;
         if (key.mEnabled)
             mListener.onRelease(primaryCode, withSliding);
     }
@@ -243,9 +258,7 @@
         mPreviousKey = keyIndex;
         if (keyIndex != oldKeyIndex) {
             if (isValidKeyIndex(oldKeyIndex)) {
-                // if new key index is not a key, old key was just released inside of the key.
-                final boolean inside = (keyIndex == NOT_A_KEY);
-                mKeys[oldKeyIndex].onReleased(inside);
+                mKeys[oldKeyIndex].onReleased();
                 mProxy.invalidateKey(mKeys[oldKeyIndex]);
             }
             if (isValidKeyIndex(keyIndex)) {
@@ -329,17 +342,18 @@
         mKeyAlreadyProcessed = false;
         mIsRepeatableKey = false;
         mIsInSlidingKeyInput = false;
-        if (isValidKeyIndex(keyIndex)) {
+        mIgnoreModifierKey = false;
+        final Key key = getKey(keyIndex);
+        if (key != null) {
             // This onPress call may have changed keyboard layout. Those cases are detected at
             // {@link #setKeyboard}. In those cases, we should update keyIndex according to the new
             // keyboard layout.
-            if (callListenerOnPressAndCheckKeyboardLayoutChange(mKeys[keyIndex], false))
+            if (callListenerOnPressAndCheckKeyboardLayoutChange(key, false))
                 keyIndex = mKeyState.onDownKey(x, y, eventTime);
-        }
-        if (isValidKeyIndex(keyIndex)) {
+
             // Accessibility disables key repeat because users may need to pause on a key to hear
             // its spoken description.
-            if (mKeys[keyIndex].mRepeatable && !mIsAccessibilityEnabled) {
+            if (key.mRepeatable && !mIsAccessibilityEnabled) {
                 repeatKey(keyIndex);
                 mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart, keyIndex, this);
                 mIsRepeatableKey = true;
@@ -349,6 +363,12 @@
         showKeyPreviewAndUpdateKeyGraphics(keyIndex);
     }
 
+    private void startSlidingKeyInput(Key key) {
+        if (!mIsInSlidingKeyInput)
+            mIgnoreModifierKey = isModifierCode(key.mCode);
+        mIsInSlidingKeyInput = true;
+    }
+
     public void onMoveEvent(int x, int y, long eventTime, PointerTrackerQueue queue) {
         if (ENABLE_ASSERTION) checkAssertion(queue);
         if (DEBUG_MOVE_EVENT)
@@ -376,8 +396,8 @@
                 // The pointer has been slid in to the new key from the previous key, we must call
                 // onRelease() first to notify that the previous key has been released, then call
                 // onPress() to notify that the new key is being pressed.
-                mIsInSlidingKeyInput = true;
                 callListenerOnRelease(oldKey, oldKey.mCode, true);
+                startSlidingKeyInput(oldKey);
                 mHandler.cancelLongPressTimers();
                 if (mIsAllowedSlidingKeyInput) {
                     // This onPress call may have changed keyboard layout. Those cases are detected
@@ -411,8 +431,8 @@
             if (oldKey != null && !isMinorMoveBounce(x, y, keyIndex)) {
                 // The pointer has been slid out from the previous key, we must call onRelease() to
                 // notify that the previous key has been released.
-                mIsInSlidingKeyInput = true;
                 callListenerOnRelease(oldKey, oldKey.mCode, true);
+                startSlidingKeyInput(oldKey);
                 mHandler.cancelLongPressTimers();
                 if (mIsAllowedSlidingKeyInput) {
                     keyState.onMoveToNewKey(keyIndex, x ,y);
@@ -423,7 +443,7 @@
                 }
             }
         }
-        showKeyPreviewAndUpdateKeyGraphics(mKeyState.getKeyIndex());
+        showKeyPreviewAndUpdateKeyGraphics(keyState.getKeyIndex());
     }
 
     public void onUpEvent(int x, int y, long eventTime, PointerTrackerQueue queue) {
diff --git a/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java b/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
index 41f8c2a..eee0ac6 100644
--- a/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
+++ b/java/src/com/android/inputmethod/keyboard/SlidingLocaleDrawable.java
@@ -63,7 +63,7 @@
         mHeight = height;
         final TextPaint textPaint = new TextPaint();
         textPaint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Medium, 18));
-        textPaint.setColor(R.color.latinkeyboard_transparent);
+        textPaint.setColor(android.R.color.transparent);
         textPaint.setTextAlign(Align.CENTER);
         textPaint.setAlpha(LatinKeyboard.OPACITY_FULLY_OPAQUE);
         textPaint.setAntiAlias(true);