diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 390f72bfa..828ad6d53 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -457,6 +457,8 @@ language among those that use the Latin alphabet. This keyboard is laid out in t
disposition that offers additional keys, but smaller keys compared to other common dispositions for
mobile devices. [CHAR LIMIT=25] -->
Alphabet (PC)
+
+ Emoji
Custom input styles
diff --git a/java/res/xml/method.xml b/java/res/xml/method.xml
index 2c3ac57ed..689b270a8 100644
--- a/java/res/xml/method.xml
+++ b/java/res/xml/method.xml
@@ -80,6 +80,7 @@
vi: Vietnamese/qwerty
zu: Zulu/qwerty
zz: QWERTY/qwerty
+ (zz: Emoji/emoji)
-->
+
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index be03d4ae5..0889f22ca 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -53,12 +53,22 @@ public final class SubtypeSwitcher {
private InputMethodInfo mShortcutInputMethodInfo;
private InputMethodSubtype mShortcutSubtype;
private InputMethodSubtype mNoLanguageSubtype;
+ private InputMethodSubtype mEmojiSubtype;
private boolean mIsNetworkConnected;
// 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, "zz", "keyboard",
- "KeyboardLayoutSet=qwerty,AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable",
+ R.string.subtype_no_language_qwerty, R.drawable.ic_subtype_keyboard,
+ SubtypeLocaleUtils.NO_LANGUAGE, "keyboard",
+ "KeyboardLayoutSet=" + SubtypeLocaleUtils.QWERTY
+ + ",AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable",
+ 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,
false /* isAuxiliary */, false /* overridesImplicitlyEnabledSubtype */);
static final class NeedsToDisplayLanguage {
@@ -271,4 +281,17 @@ public final class SubtypeSwitcher {
+ DUMMY_NO_LANGUAGE_SUBTYPE);
return DUMMY_NO_LANGUAGE_SUBTYPE;
}
+
+ public InputMethodSubtype getEmojiSubtype() {
+ if (mEmojiSubtype == null) {
+ mEmojiSubtype = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
+ SubtypeLocaleUtils.NO_LANGUAGE, SubtypeLocaleUtils.EMOJI);
+ }
+ if (mEmojiSubtype != null) {
+ return mEmojiSubtype;
+ }
+ Log.w(TAG, "Can't find Emoji subtype");
+ Log.w(TAG, "No input method subtype found; return dummy subtype: " + DUMMY_EMOJI_SUBTYPE);
+ return DUMMY_EMOJI_SUBTYPE;
+ }
}
diff --git a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
index 16728092d..102a41b4e 100644
--- a/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/SubtypeLocaleUtils.java
@@ -40,6 +40,7 @@ public final class SubtypeLocaleUtils {
// Special language code to represent "no language".
public static final String NO_LANGUAGE = "zz";
public static final String QWERTY = "qwerty";
+ public static final String EMOJI = "emoji";
public static final int UNKNOWN_KEYBOARD_LAYOUT = R.string.subtype_generic;
private static boolean sInitialized = false;