aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/drawable-hdpi/sym_bkeyboard_123_mic.pngbin2576 -> 0 bytes
-rw-r--r--java/res/drawable-hdpi/sym_bkeyboard_label_mic.pngbin0 -> 905 bytes
-rw-r--r--java/res/drawable-hdpi/sym_keyboard_123_mic.pngbin2510 -> 0 bytes
-rw-r--r--java/res/drawable-hdpi/sym_keyboard_123_mic_holo.pngbin1513 -> 0 bytes
-rw-r--r--java/res/drawable-hdpi/sym_keyboard_label_mic.pngbin0 -> 1417 bytes
-rw-r--r--java/res/drawable-hdpi/sym_keyboard_label_mic_holo.pngbin0 -> 905 bytes
-rw-r--r--java/res/drawable-mdpi/sym_bkeyboard_123_mic.pngbin1520 -> 0 bytes
-rw-r--r--java/res/drawable-mdpi/sym_bkeyboard_label_mic.pngbin0 -> 539 bytes
-rw-r--r--java/res/drawable-mdpi/sym_keyboard_123_mic.pngbin1540 -> 0 bytes
-rw-r--r--java/res/drawable-mdpi/sym_keyboard_123_mic_holo.pngbin1011 -> 0 bytes
-rw-r--r--java/res/drawable-mdpi/sym_keyboard_label_mic.pngbin0 -> 542 bytes
-rw-r--r--java/res/drawable-mdpi/sym_keyboard_label_mic_holo.pngbin0 -> 658 bytes
-rw-r--r--java/res/drawable-xhdpi/sym_bkeyboard_123_mic.pngbin3765 -> 0 bytes
-rw-r--r--java/res/drawable-xhdpi/sym_bkeyboard_label_mic.pngbin0 -> 2112 bytes
-rw-r--r--java/res/drawable-xhdpi/sym_keyboard_123_mic.pngbin3682 -> 0 bytes
-rw-r--r--java/res/drawable-xhdpi/sym_keyboard_123_mic_holo.pngbin2127 -> 0 bytes
-rw-r--r--java/res/drawable-xhdpi/sym_keyboard_label_mic.pngbin0 -> 2086 bytes
-rw-r--r--java/res/drawable-xhdpi/sym_keyboard_label_mic_holo.pngbin0 -> 1222 bytes
-rw-r--r--java/res/values-ar/donottranslate-altchars.xml8
-rw-r--r--java/res/values/attrs.xml32
-rw-r--r--java/res/values/donottranslate-altchars.xml8
-rw-r--r--java/res/values/keyboard-icons-black.xml4
-rw-r--r--java/res/values/keyboard-icons-ics.xml4
-rw-r--r--java/res/values/keyboard-icons-white.xml4
-rw-r--r--java/res/values/strings.xml3
-rw-r--r--java/res/xml-sw600dp/kbd_key_styles.xml2
-rw-r--r--java/res/xml/kbd_key_styles.xml4
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java30
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java101
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java39
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java37
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java42
32 files changed, 232 insertions, 86 deletions
diff --git a/java/res/drawable-hdpi/sym_bkeyboard_123_mic.png b/java/res/drawable-hdpi/sym_bkeyboard_123_mic.png
deleted file mode 100644
index 3e4eff698..000000000
--- a/java/res/drawable-hdpi/sym_bkeyboard_123_mic.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-hdpi/sym_bkeyboard_label_mic.png b/java/res/drawable-hdpi/sym_bkeyboard_label_mic.png
new file mode 100644
index 000000000..25702cf73
--- /dev/null
+++ b/java/res/drawable-hdpi/sym_bkeyboard_label_mic.png
Binary files differ
diff --git a/java/res/drawable-hdpi/sym_keyboard_123_mic.png b/java/res/drawable-hdpi/sym_keyboard_123_mic.png
deleted file mode 100644
index 6f0aec24c..000000000
--- a/java/res/drawable-hdpi/sym_keyboard_123_mic.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-hdpi/sym_keyboard_123_mic_holo.png b/java/res/drawable-hdpi/sym_keyboard_123_mic_holo.png
deleted file mode 100644
index ed66f7520..000000000
--- a/java/res/drawable-hdpi/sym_keyboard_123_mic_holo.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-hdpi/sym_keyboard_label_mic.png b/java/res/drawable-hdpi/sym_keyboard_label_mic.png
new file mode 100644
index 000000000..4e0a8ed8e
--- /dev/null
+++ b/java/res/drawable-hdpi/sym_keyboard_label_mic.png
Binary files differ
diff --git a/java/res/drawable-hdpi/sym_keyboard_label_mic_holo.png b/java/res/drawable-hdpi/sym_keyboard_label_mic_holo.png
new file mode 100644
index 000000000..22802433e
--- /dev/null
+++ b/java/res/drawable-hdpi/sym_keyboard_label_mic_holo.png
Binary files differ
diff --git a/java/res/drawable-mdpi/sym_bkeyboard_123_mic.png b/java/res/drawable-mdpi/sym_bkeyboard_123_mic.png
deleted file mode 100644
index 0749b5fc6..000000000
--- a/java/res/drawable-mdpi/sym_bkeyboard_123_mic.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-mdpi/sym_bkeyboard_label_mic.png b/java/res/drawable-mdpi/sym_bkeyboard_label_mic.png
new file mode 100644
index 000000000..7f0b1355f
--- /dev/null
+++ b/java/res/drawable-mdpi/sym_bkeyboard_label_mic.png
Binary files differ
diff --git a/java/res/drawable-mdpi/sym_keyboard_123_mic.png b/java/res/drawable-mdpi/sym_keyboard_123_mic.png
deleted file mode 100644
index 35afe0821..000000000
--- a/java/res/drawable-mdpi/sym_keyboard_123_mic.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-mdpi/sym_keyboard_123_mic_holo.png b/java/res/drawable-mdpi/sym_keyboard_123_mic_holo.png
deleted file mode 100644
index 4814e5141..000000000
--- a/java/res/drawable-mdpi/sym_keyboard_123_mic_holo.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-mdpi/sym_keyboard_label_mic.png b/java/res/drawable-mdpi/sym_keyboard_label_mic.png
new file mode 100644
index 000000000..a354d5321
--- /dev/null
+++ b/java/res/drawable-mdpi/sym_keyboard_label_mic.png
Binary files differ
diff --git a/java/res/drawable-mdpi/sym_keyboard_label_mic_holo.png b/java/res/drawable-mdpi/sym_keyboard_label_mic_holo.png
new file mode 100644
index 000000000..d51adbe2f
--- /dev/null
+++ b/java/res/drawable-mdpi/sym_keyboard_label_mic_holo.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/sym_bkeyboard_123_mic.png b/java/res/drawable-xhdpi/sym_bkeyboard_123_mic.png
deleted file mode 100644
index 0aefaa1c3..000000000
--- a/java/res/drawable-xhdpi/sym_bkeyboard_123_mic.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-xhdpi/sym_bkeyboard_label_mic.png b/java/res/drawable-xhdpi/sym_bkeyboard_label_mic.png
new file mode 100644
index 000000000..9bd1d65b4
--- /dev/null
+++ b/java/res/drawable-xhdpi/sym_bkeyboard_label_mic.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/sym_keyboard_123_mic.png b/java/res/drawable-xhdpi/sym_keyboard_123_mic.png
deleted file mode 100644
index bcb097967..000000000
--- a/java/res/drawable-xhdpi/sym_keyboard_123_mic.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-xhdpi/sym_keyboard_123_mic_holo.png b/java/res/drawable-xhdpi/sym_keyboard_123_mic_holo.png
deleted file mode 100644
index 0c7505874..000000000
--- a/java/res/drawable-xhdpi/sym_keyboard_123_mic_holo.png
+++ /dev/null
Binary files differ
diff --git a/java/res/drawable-xhdpi/sym_keyboard_label_mic.png b/java/res/drawable-xhdpi/sym_keyboard_label_mic.png
new file mode 100644
index 000000000..49810a02f
--- /dev/null
+++ b/java/res/drawable-xhdpi/sym_keyboard_label_mic.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/sym_keyboard_label_mic_holo.png b/java/res/drawable-xhdpi/sym_keyboard_label_mic_holo.png
new file mode 100644
index 000000000..a7d3eaa0a
--- /dev/null
+++ b/java/res/drawable-xhdpi/sym_keyboard_label_mic_holo.png
Binary files differ
diff --git a/java/res/values-ar/donottranslate-altchars.xml b/java/res/values-ar/donottranslate-altchars.xml
index 970666538..0e4f265e7 100644
--- a/java/res/values-ar/donottranslate-altchars.xml
+++ b/java/res/values-ar/donottranslate-altchars.xml
@@ -61,10 +61,10 @@
<string name="keylabel_for_symbols_percent">\u066a</string>
<string name="alternates_for_comma">,</string>
<string name="alternates_for_f1">,</string>
- <!-- @icon/5 is iconSettingsKey -->
- <string name="alternates_for_f1_settings">\\,,\@icon/5|\@integer/key_settings</string>
- <!-- @icon/10 is iconTabKey -->
- <string name="alternates_for_f1_navigate">\\,,\@icon/10|\@integer/key_tab</string>
+ <!-- @icon/3 is iconSettingsKey -->
+ <string name="alternates_for_f1_settings">\\,,\@icon/3|\@integer/key_settings</string>
+ <!-- @icon/7 is iconTabKey -->
+ <string name="alternates_for_f1_navigate">\\,,\@icon/7|\@integer/key_tab</string>
<string name="alternates_for_symbols_question">\?,¿</string>
<string name="alternates_for_symbols_semicolon">;</string>
<string name="alternates_for_symbols_percent">%,‰</string>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index af7484fa8..ab522719f 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -154,15 +154,14 @@
<attr name="isRtlKeyboard" format="boolean" />
<!-- Icon set for key top and key preview. -->
<attr name="iconShiftKey" format="reference" />
- <attr name="iconToSymbolKey" format="reference" />
- <attr name="iconToSymbolKeyWithShortcut" format="reference" />
<attr name="iconDeleteKey" format="reference" />
<attr name="iconSettingsKey" format="reference" />
- <attr name="iconShortcutKey" format="reference" />
<attr name="iconSpaceKey" format="reference" />
<attr name="iconReturnKey" format="reference" />
<attr name="iconSearchKey" format="reference" />
<attr name="iconTabKey" format="reference" />
+ <attr name="iconShortcutKey" format="reference" />
+ <attr name="iconShortcutForLabel" format="reference" />
<attr name="iconShiftedShiftKey" format="reference" />
<attr name="iconPreviewTabKey" format="reference" />
<attr name="iconPreviewSettingsKey" format="reference" />
@@ -202,32 +201,33 @@
<flag name="hasPopupHint" value="0x200" />
<flag name="hasUppercaseLetter" value="0x400" />
<flag name="hasHintLabel" value="0x800" />
+ <flag name="withIconLeft" value="0x1000" />
+ <flag name="withIconRight" value="0x2000" />
</attr>
<!-- The icon to display on the key instead of the label. -->
<attr name="keyIcon" format="enum">
<!-- This should be aligned with KeyboardIcons.ICON_* -->
<enum name="iconShiftKey" value="1" />
- <enum name="iconToSymbolKey" value="2" />
- <enum name="iconToSymbolKeyWithShortcut" value="3" />
- <enum name="iconDeleteKey" value="4" />
- <enum name="iconSettingsKey" value="5" />
- <enum name="iconShortcutKey" value="6" />
- <enum name="iconSpaceKey" value="7" />
- <enum name="iconReturnKey" value="8" />
- <enum name="iconSearchKey" value="9" />
- <enum name="iconTabKey" value="10" />
+ <enum name="iconDeleteKey" value="2" />
+ <enum name="iconSettingsKey" value="3" />
+ <enum name="iconSpaceKey" value="4" />
+ <enum name="iconReturnKey" value="5" />
+ <enum name="iconSearchKey" value="6" />
+ <enum name="iconTabKey" value="7" />
+ <enum name="iconShortcutKey" value="8" />
+ <enum name="iconShortcutForLabel" value="9" />
</attr>
<!-- Shift key icon for shifted state -->
<attr name="keyIconShifted" format="enum">
<!-- This should be aligned with KeyboardIcons.ICON_SHIFTED_* -->
- <enum name="iconShiftedShiftKey" value="11" />
+ <enum name="iconShiftedShiftKey" value="10" />
</attr>
<!-- The icon to show in the popup preview. -->
<attr name="keyIconPreview" format="enum">
<!-- This should be aligned with KeyboardIcons.ICON_PREVIEW_* -->
- <enum name="iconPreviewTabKey" value="12" />
- <enum name="iconPreviewSettingsKey" value="13" />
- <enum name="iconPreviewShortcutKey" value="14" />
+ <enum name="iconPreviewTabKey" value="11" />
+ <enum name="iconPreviewSettingsKey" value="12" />
+ <enum name="iconPreviewShortcutKey" value="13" />
</attr>
<!-- The key style to specify a set of key attributes defined by <key_style/> -->
<attr name="keyStyle" format="string" />
diff --git a/java/res/values/donottranslate-altchars.xml b/java/res/values/donottranslate-altchars.xml
index 05026508b..fbde4b9ba 100644
--- a/java/res/values/donottranslate-altchars.xml
+++ b/java/res/values/donottranslate-altchars.xml
@@ -82,10 +82,10 @@
<string name="keylabel_for_symbols_percent">%</string>
<string name="alternates_for_comma"></string>
<string name="alternates_for_f1"></string>
- <!-- @icon/5 is iconSettingsKey -->
- <string name="alternates_for_f1_settings">\@icon/5|\@integer/key_settings</string>
- <!-- @icon/10 is iconTabKey -->
- <string name="alternates_for_f1_navigate">\@icon/10|\@integer/key_tab</string>
+ <!-- @icon/3 is iconSettingsKey -->
+ <string name="alternates_for_f1_settings">\@icon/3|\@integer/key_settings</string>
+ <!-- @icon/7 is iconTabKey -->
+ <string name="alternates_for_f1_navigate">\@icon/7|\@integer/key_tab</string>
<string name="alternates_for_symbols_question">¿</string>
<string name="alternates_for_symbols_semicolon"></string>
<string name="alternates_for_symbols_percent">‰</string>
diff --git a/java/res/values/keyboard-icons-black.xml b/java/res/values/keyboard-icons-black.xml
index ff758dc4b..23d163c69 100644
--- a/java/res/values/keyboard-icons-black.xml
+++ b/java/res/values/keyboard-icons-black.xml
@@ -22,14 +22,14 @@
sym_bkeyboard_voice_off
-->
<item name="iconShiftKey">@drawable/sym_bkeyboard_shift</item>
- <item name="iconToSymbolKeyWithShortcut">@drawable/sym_bkeyboard_123_mic</item>
<item name="iconDeleteKey">@drawable/sym_bkeyboard_delete</item>
<item name="iconSettingsKey">@drawable/sym_bkeyboard_settings</item>
- <item name="iconShortcutKey">@drawable/sym_bkeyboard_mic</item>
<item name="iconSpaceKey">@drawable/sym_bkeyboard_space</item>
<item name="iconReturnKey">@drawable/sym_bkeyboard_return</item>
<item name="iconSearchKey">@drawable/sym_bkeyboard_search</item>
<item name="iconTabKey">@drawable/sym_bkeyboard_tab</item>
+ <item name="iconShortcutKey">@drawable/sym_bkeyboard_mic</item>
+ <item name="iconShortcutForLabel">@drawable/sym_bkeyboard_label_mic</item>
<item name="iconShiftedShiftKey">@drawable/sym_bkeyboard_shift_locked</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings</item>
diff --git a/java/res/values/keyboard-icons-ics.xml b/java/res/values/keyboard-icons-ics.xml
index 62859e3a3..f619691a9 100644
--- a/java/res/values/keyboard-icons-ics.xml
+++ b/java/res/values/keyboard-icons-ics.xml
@@ -21,14 +21,14 @@
sym_keyboard_123_mic_holo
-->
<item name="iconShiftKey">@drawable/sym_keyboard_shift_holo</item>
- <item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic_holo</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete_holo</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo</item>
- <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
<item name="iconSpaceKey">@drawable/sym_keyboard_space_holo</item>
<item name="iconReturnKey">@drawable/sym_keyboard_return_holo</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab_holo</item>
+ <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo</item>
+ <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic_holo</item>
<item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked_holo</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item>
diff --git a/java/res/values/keyboard-icons-white.xml b/java/res/values/keyboard-icons-white.xml
index 3c28cb771..a1765a44d 100644
--- a/java/res/values/keyboard-icons-white.xml
+++ b/java/res/values/keyboard-icons-white.xml
@@ -18,14 +18,14 @@
<style name="KeyboardIcons">
<!-- Keyboard icons -->
<item name="iconShiftKey">@drawable/sym_keyboard_shift</item>
- <item name="iconToSymbolKeyWithShortcut">@drawable/sym_keyboard_123_mic</item>
<item name="iconDeleteKey">@drawable/sym_keyboard_delete</item>
<item name="iconSettingsKey">@drawable/sym_keyboard_settings</item>
- <item name="iconShortcutKey">@drawable/sym_keyboard_mic</item>
<item name="iconSpaceKey">@drawable/sym_keyboard_space</item>
<item name="iconReturnKey">@drawable/sym_keyboard_return</item>
<item name="iconSearchKey">@drawable/sym_keyboard_search</item>
<item name="iconTabKey">@drawable/sym_keyboard_tab</item>
+ <item name="iconShortcutKey">@drawable/sym_keyboard_mic</item>
+ <item name="iconShortcutForLabel">@drawable/sym_keyboard_label_mic</item>
<item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked</item>
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<item name="iconPreviewSettingsKey">@drawable/sym_keyboard_feedback_settings</item>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index aaea9ad33..ed69fc9f0 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -121,6 +121,9 @@
<string name="label_to_alpha_key">ABC</string>
<!-- Label for "switch to symbols" key. Must be short to fit on key! [CHAR LIMIT=4] -->
<string name="label_to_symbol_key">\?123</string>
+ <!-- Label for "switch to symbols with microphone" key. This string shouldn't include the "mic"
+ part because it'll be appended by the code. Must be short to fit on key! [CHAR LIMIT=3] -->
+ <string name="label_to_symbol_with_microphone_key">123</string>
<!-- Label for Shift modifier key of symbol keyboard. Must be short to fit on key! [CHAR LIMIT=5] -->
<string name="label_more_key">More</string>
<!-- Label for "Pause" key of phone number keyboard. Must be short to fit on key! [CHAR LIMIT=5] -->
diff --git a/java/res/xml-sw600dp/kbd_key_styles.xml b/java/res/xml-sw600dp/kbd_key_styles.xml
index aff75d69a..05b683707 100644
--- a/java/res/xml-sw600dp/kbd_key_styles.xml
+++ b/java/res/xml-sw600dp/kbd_key_styles.xml
@@ -38,7 +38,7 @@
<key-style
latin:styleName="f2PopupStyle"
latin:keyLabelOption="hasPopupHint"
- latin:popupCharacters="\@icon/5|\@integer/key_settings"
+ latin:popupCharacters="\@icon/3|\@integer/key_settings"
latin:parentStyle="functionalKeyStyle" />
</default>
</switch>
diff --git a/java/res/xml/kbd_key_styles.xml b/java/res/xml/kbd_key_styles.xml
index af6d9dce3..5612251a5 100644
--- a/java/res/xml/kbd_key_styles.xml
+++ b/java/res/xml/kbd_key_styles.xml
@@ -187,7 +187,9 @@
<key-style
latin:styleName="toSymbolKeyStyle"
latin:code="@integer/key_switch_alpha_symbol"
- latin:keyIcon="iconToSymbolKeyWithShortcut"
+ latin:keyIcon="iconShortcutForLabel"
+ latin:keyLabel="@string/label_to_symbol_with_microphone_key"
+ latin:keyLabelOption="withIconRight"
latin:parentStyle="functionalKeyStyle" />
</case>
<default>
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 57a354ecf..4cc0bba6a 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -51,10 +51,10 @@ public class Key {
/** Hint label to display on the key in conjunction with the label */
public final CharSequence mHintLabel;
/** Option of the label */
- public final int mLabelOption;
- public static final int LABEL_OPTION_ALIGN_LEFT = 0x01;
- public static final int LABEL_OPTION_ALIGN_RIGHT = 0x02;
- public static final int LABEL_OPTION_ALIGN_LEFT_OF_CENTER = 0x08;
+ private final int mLabelOption;
+ private static final int LABEL_OPTION_ALIGN_LEFT = 0x01;
+ private static final int LABEL_OPTION_ALIGN_RIGHT = 0x02;
+ private static final int LABEL_OPTION_ALIGN_LEFT_OF_CENTER = 0x08;
private static final int LABEL_OPTION_LARGE_LETTER = 0x10;
private static final int LABEL_OPTION_FONT_NORMAL = 0x20;
private static final int LABEL_OPTION_FONT_MONO_SPACE = 0x40;
@@ -63,6 +63,8 @@ public class Key {
private static final int LABEL_OPTION_HAS_POPUP_HINT = 0x200;
private static final int LABEL_OPTION_HAS_UPPERCASE_LETTER = 0x400;
private static final int LABEL_OPTION_HAS_HINT_LABEL = 0x800;
+ private static final int LABEL_OPTION_WITH_ICON_LEFT = 0x1000;
+ private static final int LABEL_OPTION_WITH_ICON_RIGHT = 0x2000;
/** Icon to display instead of a label. Icon takes precedence over a label */
private Drawable mIcon;
@@ -384,6 +386,18 @@ public class Key {
}
}
+ public boolean isAlignLeft() {
+ return (mLabelOption & LABEL_OPTION_ALIGN_LEFT) != 0;
+ }
+
+ public boolean isAlignRight() {
+ return (mLabelOption & LABEL_OPTION_ALIGN_RIGHT) != 0;
+ }
+
+ public boolean isAlignLeftOfCenter() {
+ return (mLabelOption & LABEL_OPTION_ALIGN_LEFT_OF_CENTER) != 0;
+ }
+
public boolean hasPopupHint() {
return (mLabelOption & LABEL_OPTION_HAS_POPUP_HINT) != 0;
}
@@ -396,6 +410,14 @@ public class Key {
return (mLabelOption & LABEL_OPTION_HAS_HINT_LABEL) != 0;
}
+ public boolean hasLabelWithIconLeft() {
+ return (mLabelOption & LABEL_OPTION_WITH_ICON_LEFT) != 0;
+ }
+
+ public boolean hasLabelWithIconRight() {
+ return (mLabelOption & LABEL_OPTION_WITH_ICON_RIGHT) != 0;
+ }
+
public Drawable getIcon() {
return mIcon;
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index f45e81090..2d08abc19 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -82,6 +82,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
// system navigation bar.
private WindowWidthCache mWindowWidthCache;
+ private KeyboardLayoutState mSavedKeyboardState = new KeyboardLayoutState();
+
/** mIsAutoCorrectionActive indicates that auto corrected word will be input instead of
* what user actually typed. */
private boolean mIsAutoCorrectionActive;
@@ -174,6 +176,51 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
}
+ public class KeyboardLayoutState {
+ private boolean mIsValid;
+ private boolean mIsAlphabetMode;
+ private boolean mIsShiftLocked;
+ private boolean mIsShifted;
+
+ public boolean isValid() {
+ return mIsValid;
+ }
+
+ public void save() {
+ mIsAlphabetMode = isAlphabetMode();
+ mIsShiftLocked = mIsAlphabetMode && isShiftLocked();
+ mIsShifted = !mIsShiftLocked && isShiftedOrShiftLocked();
+ mIsValid = true;
+ }
+
+ public KeyboardId getKeyboardId() {
+ if (!mIsValid) return mMainKeyboardId;
+
+ if (mIsAlphabetMode) {
+ return mMainKeyboardId;
+ } else {
+ return mIsShifted ? mSymbolsShiftedKeyboardId : mSymbolsKeyboardId;
+ }
+ }
+
+ public void restore() {
+ if (!mIsValid) return;
+ mIsValid = false;
+
+ if (mIsAlphabetMode) {
+ final boolean isAlphabetMode = isAlphabetMode();
+ final boolean isShiftLocked = isAlphabetMode && isShiftLocked();
+ final boolean isShifted = !isShiftLocked && isShiftedOrShiftLocked();
+ if (mIsShiftLocked != isShiftLocked) {
+ toggleCapsLock();
+ } else if (mIsShifted != isShifted) {
+ onPressShift(false);
+ onReleaseShift(false);
+ }
+ }
+ }
+ }
+
public static KeyboardSwitcher getInstance() {
return sInstance;
}
@@ -220,22 +267,34 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public void loadKeyboard(EditorInfo editorInfo, Settings.Values settingsValues) {
- mSwitchState = SWITCH_STATE_ALPHA;
try {
mMainKeyboardId = getKeyboardId(editorInfo, false, false, settingsValues);
mSymbolsKeyboardId = getKeyboardId(editorInfo, true, false, settingsValues);
mSymbolsShiftedKeyboardId = getKeyboardId(editorInfo, true, true, settingsValues);
- setKeyboard(getKeyboard(mMainKeyboardId));
+ setKeyboard(getKeyboard(mSavedKeyboardState.getKeyboardId()));
+ updateShiftState();
} catch (RuntimeException e) {
Log.w(TAG, "loading keyboard failed: " + mMainKeyboardId, e);
LatinImeLogger.logOnException(mMainKeyboardId.toString(), e);
}
}
+ public KeyboardLayoutState getKeyboardState() {
+ return mSavedKeyboardState;
+ }
+
+ public void onFinishInputView() {
+ mIsAutoCorrectionActive = false;
+ }
+
public void onHideWindow() {
mIsAutoCorrectionActive = false;
}
+ public void registerWindowWidth() {
+ mWindowWidthCache.registerWidth();
+ }
+
@SuppressWarnings("unused")
public void onSizeChanged(int w, int h, int oldw, int oldh) {
// TODO: This hack should be removed when display metric returns a proper width.
@@ -248,21 +307,41 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
return;
// Reload keyboard with new width.
final KeyboardId newId = mCurrentId.cloneWithNewGeometry(conf.orientation, width);
+ mInputMethodService.mHandler.postRestoreKeyboardLayout();
setKeyboard(getKeyboard(newId));
}
- private void setKeyboard(final Keyboard newKeyboard) {
+ private void setKeyboard(final Keyboard keyboard) {
final Keyboard oldKeyboard = mKeyboardView.getKeyboard();
- mKeyboardView.setKeyboard(newKeyboard);
- mCurrentId = newKeyboard.mId;
+ mKeyboardView.setKeyboard(keyboard);
+ mCurrentId = keyboard.mId;
+ mSwitchState = getSwitchState(mCurrentId);
+ updateShiftLockState(keyboard);
mKeyboardView.setKeyPreviewPopupEnabled(
Settings.Values.isKeyPreviewPopupEnabled(mPrefs, mResources),
Settings.Values.getKeyPreviewPopupDismissDelay(mPrefs, mResources));
final boolean localeChanged = (oldKeyboard == null)
- || !newKeyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
+ || !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged);
}
+ private int getSwitchState(KeyboardId id) {
+ return id.equals(mMainKeyboardId) ? SWITCH_STATE_ALPHA : SWITCH_STATE_SYMBOL_BEGIN;
+ }
+
+ private void updateShiftLockState(Keyboard keyboard) {
+ if (mCurrentId.equals(mSymbolsShiftedKeyboardId)) {
+ // Symbol keyboard may have an ALT key that has a caps lock style indicator (a.k.a.
+ // sticky shift key). To show or dismiss the indicator, we need to call setShiftLocked()
+ // that takes care of the current keyboard having such ALT key or not.
+ keyboard.setShiftLocked(keyboard.hasShiftLockKey());
+ } else if (mCurrentId.equals(mSymbolsKeyboardId)) {
+ // Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the
+ // indicator, we need to call setShiftLocked(false).
+ keyboard.setShiftLocked(false);
+ }
+ }
+
private LatinKeyboard getKeyboard(KeyboardId id) {
final SoftReference<LatinKeyboard> ref = mKeyboardCache.get(id);
LatinKeyboard keyboard = (ref == null) ? null : ref.get();
@@ -605,7 +684,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
+ " symbolKeyState=" + mSymbolKeyState);
mShiftKeyState.onOtherKeyPressed();
mSymbolKeyState.onOtherKeyPressed();
- mWindowWidthCache.registerWidth();
}
public void onCancelInput() {
@@ -626,15 +704,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
if (mCurrentId.equals(mSymbolsKeyboardId)
|| !mCurrentId.equals(mSymbolsShiftedKeyboardId)) {
keyboard = getKeyboard(mSymbolsShiftedKeyboardId);
- // Symbol keyboard may have an ALT key that has a caps lock style indicator (a.k.a.
- // sticky shift key). To show or dismiss the indicator, we need to call setShiftLocked()
- // that takes care of the current keyboard having such ALT key or not.
- keyboard.setShiftLocked(keyboard.hasShiftLockKey());
} else {
keyboard = getKeyboard(mSymbolsKeyboardId);
- // Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the
- // indicator, we need to call setShiftLocked(false).
- keyboard.setShiftLocked(false);
}
setKeyboard(keyboard);
}
@@ -655,10 +726,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private void toggleKeyboardMode() {
if (mCurrentId.equals(mMainKeyboardId)) {
setKeyboard(getKeyboard(mSymbolsKeyboardId));
- mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
} else {
setKeyboard(getKeyboard(mMainKeyboardId));
- mSwitchState = SWITCH_STATE_ALPHA;
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index d1fd7e3ca..aab58b52c 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -505,6 +505,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
// Draw key label.
+ final Drawable icon = key.getIcon();
float positionX = centerX;
if (key.mLabel != null) {
// Switch the character to uppercase if shift is pressed
@@ -521,16 +522,25 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
final float baseline = centerY + labelCharHeight / 2;
// Horizontal label text alignment
- if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_LEFT) != 0) {
+ float labelWidth = 0;
+ if (key.isAlignLeft()) {
positionX = (int)params.mKeyLabelHorizontalPadding;
paint.setTextAlign(Align.LEFT);
- } else if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_RIGHT) != 0) {
+ } else if (key.isAlignRight()) {
positionX = keyWidth - (int)params.mKeyLabelHorizontalPadding;
paint.setTextAlign(Align.RIGHT);
- } else if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_LEFT_OF_CENTER) != 0) {
+ } else if (key.isAlignLeftOfCenter()) {
// TODO: Parameterise this?
positionX = centerX - labelCharWidth * 7 / 4;
paint.setTextAlign(Align.LEFT);
+ } else if (key.hasLabelWithIconLeft() && icon != null) {
+ labelWidth = getLabelWidth(label, paint) + icon.getIntrinsicWidth();
+ positionX = centerX + labelWidth / 2;
+ paint.setTextAlign(Align.RIGHT);
+ } else if (key.hasLabelWithIconRight() && icon != null) {
+ labelWidth = getLabelWidth(label, paint) + icon.getIntrinsicWidth();
+ positionX = centerX - labelWidth / 2;
+ paint.setTextAlign(Align.LEFT);
} else {
positionX = centerX;
paint.setTextAlign(Align.CENTER);
@@ -552,6 +562,19 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
// Turn off drop shadow
paint.setShadowLayer(0, 0, 0, 0);
+ if (icon != null) {
+ final int iconWidth = icon.getIntrinsicWidth();
+ final int iconHeight = icon.getIntrinsicHeight();
+ final int iconY = (keyHeight - iconHeight) / 2;
+ if (key.hasLabelWithIconLeft()) {
+ final int iconX = (int)(centerX - labelWidth / 2);
+ drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
+ } else if (key.hasLabelWithIconRight()) {
+ final int iconX = (int)(centerX + labelWidth / 2 - iconWidth);
+ drawIcon(canvas, icon, iconX, iconY, iconWidth, iconHeight);
+ }
+ }
+
if (debugShowAlign) {
final Paint line = new Paint();
drawHorizontalLine(canvas, baseline, keyWidth, 0xc0008000, line);
@@ -605,16 +628,15 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
}
// Draw key icon.
- final Drawable icon = key.getIcon();
if (key.mLabel == null && icon != null) {
final int iconWidth = icon.getIntrinsicWidth();
final int iconHeight = icon.getIntrinsicHeight();
final int iconX, alignX;
final int iconY = (keyHeight - iconHeight) / 2;
- if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_LEFT) != 0) {
+ if (key.isAlignLeft()) {
iconX = (int)params.mKeyLabelHorizontalPadding;
alignX = iconX;
- } else if ((key.mLabelOption & Key.LABEL_OPTION_ALIGN_RIGHT) != 0) {
+ } else if (key.isAlignRight()) {
iconX = keyWidth - (int)params.mKeyLabelHorizontalPadding - iconWidth;
alignX = iconX + iconWidth;
} else { // Align center
@@ -694,6 +716,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
return width;
}
+ private static float getLabelWidth(CharSequence label, Paint paint) {
+ paint.getTextBounds(label.toString(), 0, label.length(), sTextBounds);
+ return sTextBounds.width();
+ }
+
private static void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width,
int height) {
canvas.translate(x, y);
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java
index ed4608bf6..2d8b7bf11 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java
@@ -30,23 +30,22 @@ public class KeyboardIconsSet {
// This should be aligned with Keyboard.keyIcon enum.
private static final int ICON_SHIFT_KEY = 1;
- private static final int ICON_TO_SYMBOL_KEY = 2;
- private static final int ICON_TO_SYMBOL_KEY_WITH_SHORTCUT = 3;
- private static final int ICON_DELETE_KEY = 4;
- private static final int ICON_SETTINGS_KEY = 5; // This is also represented as "@icon/5" in xml.
- private static final int ICON_SHORTCUT_KEY = 6;
- private static final int ICON_SPACE_KEY = 7;
- private static final int ICON_RETURN_KEY = 8;
- private static final int ICON_SEARCH_KEY = 9;
- private static final int ICON_TAB_KEY = 10;
+ private static final int ICON_DELETE_KEY = 2;
+ private static final int ICON_SETTINGS_KEY = 3; // This is also represented as "@icon/3" in XML.
+ private static final int ICON_SPACE_KEY = 4;
+ private static final int ICON_RETURN_KEY = 5;
+ private static final int ICON_SEARCH_KEY = 6;
+ private static final int ICON_TAB_KEY = 7; // This is also represented as "@icon/7" in XML.
+ private static final int ICON_SHORTCUT_KEY = 8;
+ private static final int ICON_SHORTCUT_FOR_LABEL = 9;
// This should be aligned with Keyboard.keyIconShifted enum.
- private static final int ICON_SHIFTED_SHIFT_KEY = 11;
+ private static final int ICON_SHIFTED_SHIFT_KEY = 10;
// This should be aligned with Keyboard.keyIconPreview enum.
- private static final int ICON_PREVIEW_TAB_KEY = 12;
- private static final int ICON_PREVIEW_SETTINGS_KEY = 13;
- private static final int ICON_PREVIEW_SHORTCUT_KEY = 14;
+ private static final int ICON_PREVIEW_TAB_KEY = 11;
+ private static final int ICON_PREVIEW_SETTINGS_KEY = 12;
+ private static final int ICON_PREVIEW_SHORTCUT_KEY = 13;
- private static final int ICON_LAST = 14;
+ private static final int ICON_LAST = 13;
private final Drawable mIcons[] = new Drawable[ICON_LAST + 1];
@@ -54,16 +53,10 @@ public class KeyboardIconsSet {
switch (attrIndex) {
case R.styleable.Keyboard_iconShiftKey:
return ICON_SHIFT_KEY;
- case R.styleable.Keyboard_iconToSymbolKey:
- return ICON_TO_SYMBOL_KEY;
- case R.styleable.Keyboard_iconToSymbolKeyWithShortcut:
- return ICON_TO_SYMBOL_KEY_WITH_SHORTCUT;
case R.styleable.Keyboard_iconDeleteKey:
return ICON_DELETE_KEY;
case R.styleable.Keyboard_iconSettingsKey:
return ICON_SETTINGS_KEY;
- case R.styleable.Keyboard_iconShortcutKey:
- return ICON_SHORTCUT_KEY;
case R.styleable.Keyboard_iconSpaceKey:
return ICON_SPACE_KEY;
case R.styleable.Keyboard_iconReturnKey:
@@ -72,6 +65,10 @@ public class KeyboardIconsSet {
return ICON_SEARCH_KEY;
case R.styleable.Keyboard_iconTabKey:
return ICON_TAB_KEY;
+ case R.styleable.Keyboard_iconShortcutKey:
+ return ICON_SHORTCUT_KEY;
+ case R.styleable.Keyboard_iconShortcutForLabel:
+ return ICON_SHORTCUT_FOR_LABEL;
case R.styleable.Keyboard_iconShiftedShiftKey:
return ICON_SHIFTED_SHIFT_KEY;
case R.styleable.Keyboard_iconPreviewTabKey:
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index b2af6f9ee..d00ce78e1 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -64,6 +64,7 @@ import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardSwitcher;
+import com.android.inputmethod.keyboard.KeyboardSwitcher.KeyboardLayoutState;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.LatinKeyboard;
import com.android.inputmethod.keyboard.LatinKeyboardView;
@@ -112,6 +113,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Key events coming any faster than this are long-presses.
private static final int QUICK_PRESS = 200;
+ private static final int SCREEN_ORIENTATION_CHANGE_DETECTION_DELAY = 2;
+ private static final int ACCUMULATE_START_INPUT_VIEW_DELAY = 20;
+ private static final int RESTORE_KEYBOARD_STATE_DELAY = 200;
+
/**
* The name of the scheme used by the Package Manager to warn of a new package installation,
* replacement or removal.
@@ -218,6 +223,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private static final int MSG_SET_BIGRAM_PREDICTIONS = 7;
private static final int MSG_CONFIRM_ORIENTATION_CHANGE = 8;
private static final int MSG_START_INPUT_VIEW = 9;
+ private static final int MSG_RESTORE_KEYBOARD_LAYOUT = 10;
private static class OrientationChangeArgs {
public final int mOldWidth;
@@ -302,6 +308,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
case MSG_START_INPUT_VIEW:
latinIme.onStartInputView((EditorInfo)msg.obj, false);
break;
+ case MSG_RESTORE_KEYBOARD_LAYOUT:
+ removeMessages(MSG_UPDATE_SHIFT_STATE);
+ ((KeyboardLayoutState)msg.obj).restore();
+ break;
}
}
@@ -392,14 +402,29 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return hasMessages(MSG_SPACE_TYPED);
}
+ public void postRestoreKeyboardLayout() {
+ final LatinIME latinIme = getOuterInstance();
+ final KeyboardLayoutState state = latinIme.mKeyboardSwitcher.getKeyboardState();
+ if (state.isValid()) {
+ removeMessages(MSG_RESTORE_KEYBOARD_LAYOUT);
+ sendMessageDelayed(
+ obtainMessage(MSG_RESTORE_KEYBOARD_LAYOUT, state),
+ RESTORE_KEYBOARD_STATE_DELAY);
+ }
+ }
+
private void postConfirmOrientationChange(OrientationChangeArgs args) {
removeMessages(MSG_CONFIRM_ORIENTATION_CHANGE);
- // Will confirm whether orientation change has finished or not after 2ms again.
- sendMessageDelayed(obtainMessage(MSG_CONFIRM_ORIENTATION_CHANGE, args), 2);
+ // Will confirm whether orientation change has finished or not again.
+ sendMessageDelayed(obtainMessage(MSG_CONFIRM_ORIENTATION_CHANGE, args),
+ SCREEN_ORIENTATION_CHANGE_DETECTION_DELAY);
}
public void startOrientationChanging(int oldw, int oldh) {
postConfirmOrientationChange(new OrientationChangeArgs(oldw, oldh));
+ final LatinIME latinIme = getOuterInstance();
+ latinIme.mKeyboardSwitcher.getKeyboardState().save();
+ postRestoreKeyboardLayout();
}
public boolean postStartInputView(EditorInfo attribute) {
@@ -407,7 +432,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
removeMessages(MSG_START_INPUT_VIEW);
// Postpone onStartInputView 20ms afterward and see if orientation change has
// finished.
- sendMessageDelayed(obtainMessage(MSG_START_INPUT_VIEW, attribute), 20);
+ sendMessageDelayed(obtainMessage(MSG_START_INPUT_VIEW, attribute),
+ ACCUMULATE_START_INPUT_VIEW_DELAY);
return true;
}
return false;
@@ -596,6 +622,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onStartInputView(EditorInfo attribute, boolean restarting) {
+ mHandler.postRestoreKeyboardLayout();
if (mHandler.postStartInputView(attribute)) {
return;
}
@@ -649,7 +676,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mSubtypeSwitcher.isKeyboardMode()) {
switcher.loadKeyboard(attribute, mSettingsValues);
- switcher.updateShiftState();
}
if (mCandidateView != null)
@@ -738,7 +764,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
super.onFinishInput();
LatinImeLogger.commit();
- mKeyboardSwitcher.onAutoCorrectionStateChanged(false);
mVoiceProxy.flushVoiceInputLogs(mConfigurationChanging);
@@ -751,6 +776,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onFinishInputView(boolean finishingInput) {
super.onFinishInputView(finishingInput);
+ mKeyboardSwitcher.onFinishInputView();
KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
if (inputView != null) inputView.cancelAllMessages();
// Remove pending messages related to update suggestions
@@ -1962,16 +1988,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
mKeyboardSwitcher.loadKeyboard(getCurrentInputEditorInfo(), mSettingsValues);
initSuggest();
loadSettings();
- mKeyboardSwitcher.updateShiftState();
}
@Override
public void onPress(int primaryCode, boolean withSliding) {
- if (mKeyboardSwitcher.isVibrateAndSoundFeedbackRequired()) {
+ final KeyboardSwitcher switcher = mKeyboardSwitcher;
+ switcher.registerWindowWidth();
+ if (switcher.isVibrateAndSoundFeedbackRequired()) {
vibrate();
playKeyClick(primaryCode);
}
- KeyboardSwitcher switcher = mKeyboardSwitcher;
final boolean distinctMultiTouch = switcher.hasDistinctMultitouch();
if (distinctMultiTouch && primaryCode == Keyboard.CODE_SHIFT) {
switcher.onPressShift(withSliding);