Add dummy Emoji subtype

Bug: 6370846
Change-Id: I4fa3a6832fa316d0c6312d434be3c3ff02b52402
main
Tadashi G. Takaoka 2013-08-28 09:01:52 +09:00
parent b7eae3ffa4
commit 34cbcc1aed
4 changed files with 40 additions and 2 deletions

View File

@ -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] -->
<string name="subtype_no_language_pcqwerty">Alphabet (PC)</string>
<!-- Description for Emoji keyboard subtype [CHAR LIMIT=25] -->
<string name="subtype_emoji">Emoji</string>
<!-- Title of the preference settings for custom input styles (language and keyboard layout pairs) [CHAR LIMIT=35]-->
<string name="custom_input_styles_title">Custom input styles</string>

View File

@ -80,6 +80,7 @@
vi: Vietnamese/qwerty
zu: Zulu/qwerty
zz: QWERTY/qwerty
(zz: Emoji/emoji)
-->
<!-- TODO: use <lang>_keyboard icon instead of a common keyboard icon. -->
<!-- Note: SupportTouchPositionCorrection extra value is obsolete and maintained for backward
@ -510,4 +511,15 @@
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable,EnabledWhenDefaultIsNotAsciiCapable"
/>
<!-- Emoji subtype has to be an addtional subtype added at boot time because ICS doesn't
support Emoji. -->
<!--
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_emoji"
android:subtypeId="0xc14d88b2"
android:imeSubtypeLocale="zz"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=emoji"
/>
-->
</input-method>

View File

@ -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;
}
}

View File

@ -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;