diff options
Diffstat (limited to 'java')
17 files changed, 195 insertions, 25 deletions
diff --git a/java/res/layout/suggestions_strip.xml b/java/res/layout/suggestions_strip.xml index 36898c890..3d2f07f7b 100644 --- a/java/res/layout/suggestions_strip.xml +++ b/java/res/layout/suggestions_strip.xml @@ -71,5 +71,6 @@ android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_centerVertical="true" + android:contentDescription="@string/spoken_description_mic" style="?attr/suggestionWordStyle" /> </merge> diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 475e92f2e..769a1d986 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -74,6 +74,7 @@ <!-- Size of the text for spacebar language label, in the proportion of key height. --> <attr name="languageOnSpacebarTextRatio" format="fraction" /> <attr name="languageOnSpacebarTextColor" format="color" /> + <attr name="languageOnSpacebarTextShadowRadius" format="float" /> <attr name="languageOnSpacebarTextShadowColor" format="color" /> <!-- Background image for the spacebar. --> <attr name="spacebarBackground" format="reference" /> @@ -217,7 +218,12 @@ <attr name="iconSettingsKey" format="reference" /> <attr name="iconSpaceKey" format="reference" /> <attr name="iconEnterKey" format="reference" /> + <attr name="iconGoKey" format="reference" /> <attr name="iconSearchKey" format="reference" /> + <attr name="iconSendKey" format="reference" /> + <attr name="iconNextKey" format="reference" /> + <attr name="iconDoneKey" format="reference" /> + <attr name="iconPreviousKey" format="reference" /> <attr name="iconTabKey" format="reference" /> <attr name="iconShortcutKey" format="reference" /> <attr name="iconSpaceKeyForNumberLayout" format="reference" /> @@ -431,6 +437,7 @@ <!-- This should be aligned with KeyboardId.IME_ACTION_* --> <enum name="actionCustomLabel" value="0x100" /> </attr> + <attr name="isIconDefined" format="string" /> <attr name="localeCode" format="string" /> <attr name="languageCode" format="string" /> <attr name="countryCode" format="string" /> diff --git a/java/res/values/colors.xml b/java/res/values/colors.xml index dabb4d65e..baa0887bc 100644 --- a/java/res/values/colors.xml +++ b/java/res/values/colors.xml @@ -26,7 +26,6 @@ <color name="suggested_word_color_ics">#B233B5E5</color> <color name="highlight_translucent_color_ics">#9933B5E5</color> <color name="key_text_color_holo">@android:color/white</color> - <color name="key_text_shadow_color_holo">@android:color/transparent</color> <color name="key_text_inactivated_color_holo">#66E0E4E5</color> <color name="key_hint_letter_color_holo">#80000000</color> <color name="key_hint_label_color_holo">#A0FFFFFF</color> diff --git a/java/res/values/keyboard-icons-lmp.xml b/java/res/values/keyboard-icons-lmp.xml index a9cbabca6..39e0fe306 100644 --- a/java/res/values/keyboard-icons-lmp.xml +++ b/java/res/values/keyboard-icons-lmp.xml @@ -26,7 +26,13 @@ <item name="iconSettingsKey">@drawable/sym_keyboard_settings_holo_dark</item> <item name="iconSpaceKey">@drawable/sym_keyboard_space_holo_dark</item> <item name="iconEnterKey">@drawable/sym_keyboard_return_holo_dark</item> + <!-- TODO: Uncomment those icon definitions once we have those icon assets. --> + <!-- <item name="iconGoKey">@drawable/sym_keyboard_go_holo_dark</item> --> <item name="iconSearchKey">@drawable/sym_keyboard_search_holo_dark</item> + <!-- <item name="iconSendKey">@drawable/sym_keyboard_send_holo_dark</item> --> + <!-- <item name="iconNextKey">@drawable/sym_keyboard_next_holo_dark</item> --> + <!-- <item name="iconDoneKey">@drawable/sym_keyboard_done_holo_dark</item> --> + <!-- <item name="iconPreviousKey">@drawable/sym_keyboard_previous_holo_dark</item> --> <item name="iconTabKey">@drawable/sym_keyboard_tab_holo_dark</item> <item name="iconShortcutKey">@drawable/sym_keyboard_voice_holo_dark</item> <item name="iconSpaceKeyForNumberLayout">@drawable/sym_keyboard_space_holo_dark</item> diff --git a/java/res/values/strings-talkback-descriptions.xml b/java/res/values/strings-talkback-descriptions.xml index 4ffca10c8..80406d02f 100644 --- a/java/res/values/strings-talkback-descriptions.xml +++ b/java/res/values/strings-talkback-descriptions.xml @@ -35,10 +35,14 @@ <string name="spoken_description_unknown">Key code %d</string> <!-- Spoken description for the "Shift" keyboard key when "Shift" is off. --> <string name="spoken_description_shift">Shift</string> + <!-- Spoken description for the "Shift" keyboard key in symbols mode. --> + <string name="spoken_description_symbols_shift">More symbols</string> <!-- Spoken description for the "Shift" keyboard key when "Shift" is on. --> - <string name="spoken_description_shift_shifted">Shift on (tap to disable)</string> + <string name="spoken_description_shift_shifted">Shift</string> + <!-- Spoken description for the "Shift" keyboard key in 2nd symbols (a.k.a. symbols shift) mode. --> + <string name="spoken_description_symbols_shift_shifted">Symbols</string> <!-- Spoken description for the "Shift" keyboard key when "Caps lock" is on. --> - <string name="spoken_description_caps_lock">Caps lock on (tap to disable)</string> + <string name="spoken_description_caps_lock">Shift</string> <!-- Spoken description for the "Delete" keyboard key. --> <string name="spoken_description_delete">Delete</string> <!-- Spoken description for the "To Symbol" keyboard key. --> @@ -76,8 +80,8 @@ <string name="spoken_description_shiftmode_locked">Caps lock enabled</string> <!-- Spoken feedback after changing to the symbols keyboard. --> <string name="spoken_description_mode_symbol">Symbols mode</string> - <!-- Spoken feedback after changing to the symbols shift keyboard. --> - <string name="spoken_description_mode_symbol_shift">Symbols shift mode</string> + <!-- Spoken feedback after changing to the 2nd symbols (a.k.a. symbols shift) keyboard. --> + <string name="spoken_description_mode_symbol_shift">More symbols mode</string> <!-- Spoken feedback after changing to the alphanumeric keyboard. --> <string name="spoken_description_mode_alpha">Letters mode</string> <!-- Spoken feedback after changing to the phone dialer keyboard. --> diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 616dbd82c..d7943eeaf 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -56,8 +56,8 @@ <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> <item name="keyPreviewTextColor">@color/key_text_color_holo</item> - <item name="keyTextShadowColor">@color/key_text_shadow_color_holo</item> - <item name="keyTextShadowRadius">0.0</item> + <!-- A negative value to disable key text shadow layer. --> + <item name="keyTextShadowRadius">-1.0</item> </style> <style name="MainKeyboardView.ICS" @@ -71,6 +71,7 @@ <item name="autoCorrectionSpacebarLedEnabled">false</item> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> <item name="languageOnSpacebarTextColor">@color/spacebar_text_color_holo</item> + <item name="languageOnSpacebarTextShadowRadius">1.0</item> <item name="languageOnSpacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item> <item name="spacebarBackground">@drawable/btn_keyboard_spacebar_ics</item> </style> diff --git a/java/res/values/themes-klp.xml b/java/res/values/themes-klp.xml index 9bb3d79a7..13500fef2 100644 --- a/java/res/values/themes-klp.xml +++ b/java/res/values/themes-klp.xml @@ -56,8 +56,8 @@ <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> <item name="keyPreviewTextColor">@color/key_text_color_holo</item> - <item name="keyTextShadowColor">@color/key_text_shadow_color_holo</item> - <item name="keyTextShadowRadius">0.0</item> + <!-- A negative value to disable key text shadow layer. --> + <item name="keyTextShadowRadius">-1.0</item> </style> <style name="MainKeyboardView.KLP" @@ -71,6 +71,7 @@ <item name="autoCorrectionSpacebarLedEnabled">false</item> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> <item name="languageOnSpacebarTextColor">@color/spacebar_text_color_holo</item> + <item name="languageOnSpacebarTextShadowRadius">1.0</item> <item name="languageOnSpacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item> <item name="spacebarBackground">@drawable/btn_keyboard_spacebar_klp</item> </style> diff --git a/java/res/values/themes-lmp.xml b/java/res/values/themes-lmp.xml index 773da196d..41c4d09d5 100644 --- a/java/res/values/themes-lmp.xml +++ b/java/res/values/themes-lmp.xml @@ -56,8 +56,8 @@ <item name="keyShiftedLetterHintInactivatedColor">@color/key_shifted_letter_hint_inactivated_color_holo</item> <item name="keyShiftedLetterHintActivatedColor">@color/key_shifted_letter_hint_activated_color_holo</item> <item name="keyPreviewTextColor">@color/key_text_color_holo</item> - <item name="keyTextShadowColor">@color/key_text_shadow_color_holo</item> - <item name="keyTextShadowRadius">0.0</item> + <!-- A negative value to disable key text shadow layer. --> + <item name="keyTextShadowRadius">-1.0</item> </style> <style name="MainKeyboardView.LMP" @@ -71,6 +71,7 @@ <item name="autoCorrectionSpacebarLedEnabled">false</item> <item name="autoCorrectionSpacebarLedIcon">@drawable/sym_keyboard_space_led_holo</item> <item name="languageOnSpacebarTextColor">@color/spacebar_text_color_holo</item> + <item name="languageOnSpacebarTextShadowRadius">1.0</item> <item name="languageOnSpacebarTextShadowColor">@color/spacebar_text_shadow_color_holo</item> <item name="spacebarBackground">@drawable/btn_keyboard_spacebar_lmp</item> </style> diff --git a/java/res/xml-sw600dp/key_styles_enter.xml b/java/res/xml-sw600dp/key_styles_enter.xml index 0699e4527..99ac10873 100644 --- a/java/res/xml-sw600dp/key_styles_enter.xml +++ b/java/res/xml-sw600dp/key_styles_enter.xml @@ -117,6 +117,16 @@ </case> <case latin:imeAction="actionGo" + latin:isIconDefined="go_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/go_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionGo" > <key-style latin:styleName="enterKeyStyle" @@ -126,6 +136,16 @@ </case> <case latin:imeAction="actionNext" + latin:isIconDefined="next_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/next_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionNext" > <key-style latin:styleName="enterKeyStyle" @@ -135,6 +155,16 @@ </case> <case latin:imeAction="actionPrevious" + latin:isIconDefined="previous_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/previous_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionPrevious" > <key-style latin:styleName="enterKeyStyle" @@ -144,6 +174,16 @@ </case> <case latin:imeAction="actionDone" + latin:isIconDefined="done_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/done_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionDone" > <key-style latin:styleName="enterKeyStyle" @@ -153,6 +193,16 @@ </case> <case latin:imeAction="actionSend" + latin:isIconDefined="send_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/send_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionSend" > <key-style latin:styleName="enterKeyStyle" diff --git a/java/res/xml/key_styles_enter.xml b/java/res/xml/key_styles_enter.xml index acb27abb1..8bba136bd 100644 --- a/java/res/xml/key_styles_enter.xml +++ b/java/res/xml/key_styles_enter.xml @@ -284,6 +284,16 @@ </case> <case latin:imeAction="actionGo" + latin:isIconDefined="go_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/go_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionGo" > <key-style latin:styleName="enterKeyStyle" @@ -293,6 +303,16 @@ </case> <case latin:imeAction="actionNext" + latin:isIconDefined="next_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/next_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionNext" > <key-style latin:styleName="enterKeyStyle" @@ -302,6 +322,16 @@ </case> <case latin:imeAction="actionPrevious" + latin:isIconDefined="previous_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/previous_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionPrevious" > <key-style latin:styleName="enterKeyStyle" @@ -311,6 +341,16 @@ </case> <case latin:imeAction="actionDone" + latin:isIconDefined="done_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/done_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionDone" > <key-style latin:styleName="enterKeyStyle" @@ -320,6 +360,16 @@ </case> <case latin:imeAction="actionSend" + latin:isIconDefined="send_key" + > + <key-style + latin:styleName="enterKeyStyle" + latin:keySpec="!icon/send_key|!code/key_enter" + latin:backgroundType="action" + latin:parentStyle="defaultEnterKeyStyle" /> + </case> + <case + latin:imeAction="actionSend" > <key-style latin:styleName="enterKeyStyle" diff --git a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java index 2e6649bf2..0499a3456 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java +++ b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java @@ -189,9 +189,14 @@ public final class KeyCodeDescriptionMapper { break; case KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED: case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED: - case KeyboardId.ELEMENT_SYMBOLS_SHIFTED: resId = R.string.spoken_description_shift_shifted; break; + case KeyboardId.ELEMENT_SYMBOLS: + resId = R.string.spoken_description_symbols_shift; + break; + case KeyboardId.ELEMENT_SYMBOLS_SHIFTED: + resId = R.string.spoken_description_symbols_shift_shifted; + break; default: resId = R.string.spoken_description_shift; } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 8ca00b005..4450a4474 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -82,6 +82,7 @@ public class KeyboardView extends View { private final float mVerticalCorrection; private final Drawable mKeyBackground; private final Rect mKeyBackgroundPadding = new Rect(); + private static final float KET_TEXT_SHADOW_RADIUS_DISABLED = -1.0f; // HORIZONTAL ELLIPSIS "...", character for popup hint. private static final String POPUP_HINT_CHAR = "\u2026"; @@ -133,7 +134,7 @@ public class KeyboardView extends View { mKeyShiftedLetterHintPadding = keyboardViewAttr.getDimension( R.styleable.KeyboardView_keyShiftedLetterHintPadding, 0.0f); mKeyTextShadowRadius = keyboardViewAttr.getFloat( - R.styleable.KeyboardView_keyTextShadowRadius, 0.0f); + R.styleable.KeyboardView_keyTextShadowRadius, KET_TEXT_SHADOW_RADIUS_DISABLED); mVerticalCorrection = keyboardViewAttr.getDimension( R.styleable.KeyboardView_verticalCorrection, 0.0f); keyboardViewAttr.recycle(); @@ -414,18 +415,23 @@ public class KeyboardView extends View { } } - paint.setColor(key.selectTextColor(params)); if (key.isEnabled()) { - // Set a drop shadow for the text - paint.setShadowLayer(mKeyTextShadowRadius, 0.0f, 0.0f, params.mTextShadowColor); + paint.setColor(key.selectTextColor(params)); + // Set a drop shadow for the text if the shadow radius is positive value. + if (mKeyTextShadowRadius > 0.0f) { + paint.setShadowLayer(mKeyTextShadowRadius, 0.0f, 0.0f, params.mTextShadowColor); + } else { + paint.clearShadowLayer(); + } } else { // Make label invisible paint.setColor(Color.TRANSPARENT); + paint.clearShadowLayer(); } blendAlpha(paint, params.mAnimAlpha); canvas.drawText(label, 0, label.length(), positionX, baseline, paint); // Turn off drop shadow and reset x-scale. - paint.setShadowLayer(0.0f, 0.0f, 0.0f, Color.TRANSPARENT); + paint.clearShadowLayer(); paint.setTextScaleX(1.0f); if (icon != null) { diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 8f79a9128..1a8e4b7e9 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -74,6 +74,7 @@ import java.util.WeakHashMap; * @attr ref R.styleable#MainKeyboardView_autoCorrectionSpacebarLedIcon * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextRatio * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextColor + * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextShadowRadius * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarTextShadowColor * @attr ref R.styleable#MainKeyboardView_spacebarBackground * @attr ref R.styleable#MainKeyboardView_languageOnSpacebarFinalAlpha @@ -129,7 +130,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack private final float mLanguageOnSpacebarTextRatio; private float mLanguageOnSpacebarTextSize; private final int mLanguageOnSpacebarTextColor; + private final float mLanguageOnSpacebarTextShadowRadius; private final int mLanguageOnSpacebarTextShadowColor; + private static final float LANGUAGE_ON_SPACEBAR_TEXT_SHADOW_RADIUS_DISABLED = -1.0f; // The minimum x-scale to fit the language name on spacebar. private static final float MINIMUM_XSCALE_OF_LANGUAGE_NAME = 0.8f; // Stuff to draw auto correction LED on spacebar. @@ -231,6 +234,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack R.styleable.MainKeyboardView_languageOnSpacebarTextRatio, 1, 1, 1.0f); mLanguageOnSpacebarTextColor = mainKeyboardViewAttr.getColor( R.styleable.MainKeyboardView_languageOnSpacebarTextColor, 0); + mLanguageOnSpacebarTextShadowRadius = mainKeyboardViewAttr.getFloat( + R.styleable.MainKeyboardView_languageOnSpacebarTextShadowRadius, + LANGUAGE_ON_SPACEBAR_TEXT_SHADOW_RADIUS_DISABLED); mLanguageOnSpacebarTextShadowColor = mainKeyboardViewAttr.getColor( R.styleable.MainKeyboardView_languageOnSpacebarTextShadowColor, 0); mLanguageOnSpacebarFinalAlpha = mainKeyboardViewAttr.getInt( @@ -948,12 +954,17 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack final float descent = paint.descent(); final float textHeight = -paint.ascent() + descent; final float baseline = height / 2 + textHeight / 2; - paint.setColor(mLanguageOnSpacebarTextShadowColor); - paint.setAlpha(mLanguageOnSpacebarAnimAlpha); - canvas.drawText(language, width / 2, baseline - descent - 1, paint); + if (mLanguageOnSpacebarTextShadowRadius > 0.0f) { + paint.setShadowLayer(mLanguageOnSpacebarTextShadowRadius, 0, 0, + mLanguageOnSpacebarTextShadowColor); + } else { + paint.clearShadowLayer(); + } paint.setColor(mLanguageOnSpacebarTextColor); paint.setAlpha(mLanguageOnSpacebarAnimAlpha); canvas.drawText(language, width / 2, baseline - descent, paint); + paint.clearShadowLayer(); + paint.setTextScaleX(1.0f); } // Draw the spacebar icon at the bottom diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java index dfe0df04c..2aeeed87f 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -664,6 +664,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> { R.styleable.Keyboard_Case_isMultiLine, id.isMultiLine()); final boolean imeActionMatched = matchInteger(caseAttr, R.styleable.Keyboard_Case_imeAction, id.imeAction()); + final boolean isIconDefinedMatched = isIconDefined(caseAttr, + R.styleable.Keyboard_Case_isIconDefined, mParams.mIconsSet); final boolean localeCodeMatched = matchString(caseAttr, R.styleable.Keyboard_Case_localeCode, id.mLocale.toString()); final boolean languageCodeMatched = matchString(caseAttr, @@ -675,10 +677,11 @@ public class KeyboardBuilder<KP extends KeyboardParams> { && passwordInputMatched && clobberSettingsKeyMatched && supportsSwitchingToShortcutImeMatched && hasShortcutKeyMatched && languageSwitchKeyEnabledMatched && isMultiLineMatched && imeActionMatched - && localeCodeMatched && languageCodeMatched && countryCodeMatched; + && isIconDefinedMatched && localeCodeMatched && languageCodeMatched + && countryCodeMatched; if (DEBUG) { - startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE, + startTag("<%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s>%s", TAG_CASE, textAttr(caseAttr.getString( R.styleable.Keyboard_Case_keyboardLayoutSet), "keyboardLayoutSet"), textAttr(caseAttr.getString( @@ -704,6 +707,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> { "languageSwitchKeyEnabled"), booleanAttr(caseAttr, R.styleable.Keyboard_Case_isMultiLine, "isMultiLine"), + textAttr(caseAttr.getString(R.styleable.Keyboard_Case_isIconDefined), + "isIconDefined"), textAttr(caseAttr.getString(R.styleable.Keyboard_Case_localeCode), "localeCode"), textAttr(caseAttr.getString(R.styleable.Keyboard_Case_languageCode), @@ -755,6 +760,16 @@ public class KeyboardBuilder<KP extends KeyboardParams> { return false; } + private static boolean isIconDefined(final TypedArray a, final int index, + final KeyboardIconsSet iconsSet) { + if (!a.hasValue(index)) { + return true; + } + final String iconName = a.getString(index); + final int iconId = KeyboardIconsSet.getIconId(iconName); + return iconsSet.getIconDrawable(iconId) != null; + } + private boolean parseDefault(final XmlPullParser parser, final KeyboardRow row, final boolean skip) throws XmlPullParserException, IOException { if (DEBUG) startTag("<%s>", TAG_DEFAULT); diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java index 6c9b5adc3..65d6a5633 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java @@ -42,7 +42,12 @@ public final class KeyboardIconsSet { public static final String NAME_SPACE_KEY = "space_key"; public static final String NAME_SPACE_KEY_FOR_NUMBER_LAYOUT = "space_key_for_number_layout"; public static final String NAME_ENTER_KEY = "enter_key"; + public static final String NAME_GO_KEY = "go_key"; public static final String NAME_SEARCH_KEY = "search_key"; + public static final String NAME_SEND_KEY = "send_key"; + public static final String NAME_NEXT_KEY = "next_key"; + public static final String NAME_DONE_KEY = "done_key"; + public static final String NAME_PREVIOUS_KEY = "previous_key"; public static final String NAME_TAB_KEY = "tab_key"; public static final String NANE_TAB_KEY_PREVIEW = "tab_key_preview"; public static final String NAME_SHORTCUT_KEY = "shortcut_key"; @@ -64,7 +69,12 @@ public final class KeyboardIconsSet { NAME_SETTINGS_KEY, R.styleable.Keyboard_iconSettingsKey, NAME_SPACE_KEY, R.styleable.Keyboard_iconSpaceKey, NAME_ENTER_KEY, R.styleable.Keyboard_iconEnterKey, + NAME_GO_KEY, R.styleable.Keyboard_iconGoKey, NAME_SEARCH_KEY, R.styleable.Keyboard_iconSearchKey, + NAME_SEND_KEY, R.styleable.Keyboard_iconSendKey, + NAME_NEXT_KEY, R.styleable.Keyboard_iconNextKey, + NAME_DONE_KEY, R.styleable.Keyboard_iconDoneKey, + NAME_PREVIOUS_KEY, R.styleable.Keyboard_iconPreviousKey, NAME_TAB_KEY, R.styleable.Keyboard_iconTabKey, NAME_SHORTCUT_KEY, R.styleable.Keyboard_iconShortcutKey, NAME_SPACE_KEY_FOR_NUMBER_LAYOUT, R.styleable.Keyboard_iconSpaceKeyForNumberLayout, diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 94a1e3658..999508e92 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -414,8 +414,8 @@ public final class BinaryDictionary extends Dictionary { public WordProperty mWordProperty; public int mNextToken; - public GetNextWordPropertyResult(final WordProperty wordPreperty, final int nextToken) { - mWordProperty = wordPreperty; + public GetNextWordPropertyResult(final WordProperty wordProperty, final int nextToken) { + mWordProperty = wordProperty; mNextToken = nextToken; } } diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java index 8bfa63c3c..810bda758 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java @@ -381,6 +381,7 @@ final class SuggestionStripLayoutHelper { } // Disable this suggestion if the suggestion is null or empty. + // TODO: Fix disabled {@link TextView}'s content description. wordView.setEnabled(!TextUtils.isEmpty(word)); final CharSequence text = getEllipsizedText(word, width, wordView.getPaint()); final float scaleX = getTextScaleX(word, width, wordView.getPaint()); @@ -424,7 +425,9 @@ final class SuggestionStripLayoutHelper { final int countInStrip) { // Clear all suggestions first for (int positionInStrip = 0; positionInStrip < countInStrip; ++positionInStrip) { - mWordViews.get(positionInStrip).setText(null); + final TextView wordView = mWordViews.get(positionInStrip); + wordView.setText(null); + wordView.setTag(null); // Make this inactive for touches in {@link #layoutWord(int,int)}. if (SuggestionStripView.DBG) { mDebugInfoViews.get(positionInStrip).setText(null); |