From 51f275d8be314dde33119ed0fdfef5d3ca70a251 Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka Date: Wed, 18 Sep 2013 14:27:48 +0900 Subject: [PATCH] Set EmojiCapable Bug: 10240645 Change-Id: I891309c2a82f8d10f8fdb0872403a7a235e27b5f --- java/res/xml/method.xml | 128 +++++++++--------- .../android/inputmethod/latin/Constants.java | 5 + .../inputmethod/latin/SubtypeSwitcher.java | 13 +- .../latin/utils/AdditionalSubtypeUtils.java | 6 +- 4 files changed, 81 insertions(+), 71 deletions(-) diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml index 6014646bb..d7424c0c7 100644 --- a/java/res/xml/method.xml +++ b/java/res/xml/method.xml @@ -99,112 +99,112 @@ android:subtypeId="0xc9194f98" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" - android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection" + android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection,EmojiCapable" /> @@ -551,7 +551,7 @@ android:subtypeId="0xc14d88b2" android:imeSubtypeLocale="zz" android:imeSubtypeMode="keyboard" - android:imeSubtypeExtraValue="KeyboardLayoutSet=emoji" + android:imeSubtypeExtraValue="KeyboardLayoutSet=emoji,EmojiCapable" /> --> diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java index 029ba02ed..6976f5f3a 100644 --- a/java/src/com/android/inputmethod/latin/Constants.java +++ b/java/src/com/android/inputmethod/latin/Constants.java @@ -75,6 +75,11 @@ public final class Constants { */ public static final String ASCII_CAPABLE = "AsciiCapable"; + /** + * The subtype extra value used to indicate that the subtype keyboard layout is capable + * for typing EMOJI characters. + */ + public static final String EMOJI_CAPABLE = "EmojiCapable"; /** * The subtype extra value used to indicate that the subtype require network connection * to work. diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java index 0889f22ca..772e25200 100644 --- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java +++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java @@ -59,16 +59,19 @@ public final class SubtypeSwitcher { // Dummy no language QWERTY subtype. See {@link R.xml.method}. private static final InputMethodSubtype DUMMY_NO_LANGUAGE_SUBTYPE = new InputMethodSubtype( R.string.subtype_no_language_qwerty, R.drawable.ic_subtype_keyboard, - SubtypeLocaleUtils.NO_LANGUAGE, "keyboard", - "KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY - + ",AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable", + SubtypeLocaleUtils.NO_LANGUAGE, "keyboard", "KeyboardLayoutSet=" + + SubtypeLocaleUtils.QWERTY + + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE + + ",EnabledWhenDefaultIsNotAsciiCapable," + + Constants.Subtype.ExtraValue.EMOJI_CAPABLE, false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */); // Caveat: We probably should remove this when we add an Emoji subtype in {@link R.xml.method}. // Dummy Emoji subtype. See {@link R.xml.method}. private static final InputMethodSubtype DUMMY_EMOJI_SUBTYPE = new InputMethodSubtype( R.string.subtype_emoji, R.drawable.ic_subtype_keyboard, - SubtypeLocaleUtils.NO_LANGUAGE, "keyboard", - "KeyboardLayoutSet=" + SubtypeLocaleUtils.EMOJI, + SubtypeLocaleUtils.NO_LANGUAGE, "keyboard", "KeyboardLayoutSet=" + + SubtypeLocaleUtils.EMOJI + "," + + Constants.Subtype.ExtraValue.EMOJI_CAPABLE, false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */); static final class NeedsToDisplayLanguage { diff --git a/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java b/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java index 215faa0c7..3082bf4b7 100644 --- a/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/AdditionalSubtypeUtils.java @@ -25,6 +25,7 @@ import android.os.Build; import android.text.TextUtils; import android.view.inputmethod.InputMethodSubtype; +import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.R; import java.util.ArrayList; @@ -61,8 +62,9 @@ public final class AdditionalSubtypeUtils { IS_ADDITIONAL_SUBTYPE, layoutDisplayNameExtraValue); final int nameId = SubtypeLocaleUtils.getSubtypeNameId(localeString, keyboardLayoutSetName); return new InputMethodSubtype(nameId, R.drawable.ic_subtype_keyboard, - localeString, KEYBOARD_MODE, - layoutExtraValue + "," + additionalSubtypeExtraValue, false, false); + localeString, KEYBOARD_MODE, layoutExtraValue + "," + additionalSubtypeExtraValue + + "," + Constants.Subtype.ExtraValue.ASCII_CAPABLE + + "," + Constants.Subtype.ExtraValue.EMOJI_CAPABLE, false, false); } public static String getPrefSubtype(final InputMethodSubtype subtype) {