diff options
Diffstat (limited to 'java/src/com/android/inputmethod')
18 files changed, 292 insertions, 205 deletions
diff --git a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java index 5c4e9af68..700709d50 100644 --- a/java/src/com/android/inputmethod/deprecated/VoiceProxy.java +++ b/java/src/com/android/inputmethod/deprecated/VoiceProxy.java @@ -435,44 +435,6 @@ public class VoiceProxy implements VoiceInput.UiListener { } } - /** - * Tries to apply any voice alternatives for the word if this was a spoken word and - * there are voice alternatives. - * @param touching The word that the cursor is touching, with position information - * @return true if an alternative was found, false otherwise. - */ - public boolean applyVoiceAlternatives(EditingUtils.SelectedWord touching) { - if (!VOICE_INSTALLED) { - return false; - } - // Search for result in spoken word alternatives - String selectedWord = touching.mWord.toString().trim(); - if (!mWordToSuggestions.containsKey(selectedWord)) { - selectedWord = selectedWord.toLowerCase(); - } - if (mWordToSuggestions.containsKey(selectedWord)) { - mShowingVoiceSuggestions = true; - List<CharSequence> suggestions = mWordToSuggestions.get(selectedWord); - SuggestedWords.Builder builder = new SuggestedWords.Builder(); - // If the first letter of touching is capitalized, make all the suggestions - // start with a capital letter. - if (Character.isUpperCase(touching.mWord.charAt(0))) { - for (CharSequence word : suggestions) { - String str = word.toString(); - word = Character.toUpperCase(str.charAt(0)) + str.substring(1); - builder.addWord(word); - } - } else { - builder.addWords(suggestions, null); - } - builder.setTypedWordValid(true).setHasMinimalSuggestion(true); - mService.setSuggestions(builder.build()); -// mService.setCandidatesViewShown(true); - return true; - } - return false; - } - public void handleBackspace() { if (!VOICE_INSTALLED) { return; diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index f839376c0..a719b4aa7 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -62,7 +62,7 @@ public class Key { private static final int LABEL_FLAGS_LARGE_LETTER = 0x10; private static final int LABEL_FLAGS_FONT_NORMAL = 0x20; private static final int LABEL_FLAGS_FONT_MONO_SPACE = 0x40; - private static final int LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO = 0x80; + public static final int LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO = 0x80; private static final int LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO = 0x100; private static final int LABEL_FLAGS_HAS_POPUP_HINT = 0x200; private static final int LABEL_FLAGS_HAS_SHIFTED_LETTER_HINT = 0x400; @@ -103,11 +103,16 @@ public class Key { public final CharSequence mOutputText; /** More keys */ public final String[] mMoreKeys; - /** More keys maximum column number */ - public final int mMaxMoreKeysColumn; - public static final int MORE_KEYS_FIXED_COLUMN_ORDER = 0x80000000; - private static final String AUTO_COLUMN_ORDER = "!autoColumnOrder!"; - private static final String FIXED_COLUMN_ORDER = "!fixedColumnOrder!"; + /** More keys column number and flags */ + private final int mMoreKeysColumnAndFlags; + private static final int MORE_KEYS_COLUMN_MASK = 0x000000ff; + private static final int MORE_KEYS_FLAGS_FIXED_COLUMN_ORDER = 0x80000000; + private static final int MORE_KEYS_FLAGS_HAS_LABELS = 0x40000000; + private static final int MORE_KEYS_FLAGS_NEEDS_DIVIDERS = 0x40000000; + private static final String MORE_KEYS_AUTO_COLUMN_ORDER = "!autoColumnOrder!"; + private static final String MORE_KEYS_FIXED_COLUMN_ORDER = "!fixedColumnOrder!"; + private static final String MORE_KEYS_HAS_LABELS = "!hasLabels!"; + private static final String MORE_KEYS_NEEDS_DIVIDERS = "!needsDividers!"; /** Background type that represents different key background visual than normal one. */ public final int mBackgroundType; @@ -134,33 +139,34 @@ public class Key { * This constructor is being used only for key in more keys keyboard. */ public Key(Resources res, Keyboard.Params params, String moreKeySpec, - int x, int y, int width, int height) { + int x, int y, int width, int height, int labelFlags) { this(params, KeySpecParser.getLabel(moreKeySpec), null, KeySpecParser.getIconId(moreKeySpec), KeySpecParser.getCode(res, moreKeySpec), KeySpecParser.getOutputText(moreKeySpec), - x, y, width, height); + x, y, width, height, labelFlags); } /** * This constructor is being used only for key in popup suggestions pane. */ public Key(Keyboard.Params params, String label, String hintLabel, int iconId, - int code, CharSequence outputText, int x, int y, int width, int height) { + int code, String outputText, int x, int y, int width, int height, int labelFlags) { mHeight = height - params.mVerticalGap; mHorizontalGap = params.mHorizontalGap; mVerticalGap = params.mVerticalGap; mVisualInsetsLeft = mVisualInsetsRight = 0; mWidth = width - mHorizontalGap; mHintLabel = hintLabel; - mLabelFlags = 0; + mLabelFlags = labelFlags; mBackgroundType = BACKGROUND_TYPE_NORMAL; mActionFlags = 0; mMoreKeys = null; - mMaxMoreKeysColumn = 0; + mMoreKeysColumnAndFlags = 0; mLabel = label; mOutputText = outputText; mCode = code; + mEnabled = (code != Keyboard.CODE_UNSPECIFIED); mAltCode = Keyboard.CODE_UNSPECIFIED; mIconId = iconId; mDisabledIconId = KeyboardIconsSet.ICON_UNDEFINED; @@ -236,15 +242,24 @@ public class Key { final boolean preserveCase = (mLabelFlags & LABEL_FLAGS_PRESERVE_CASE) != 0; int actionFlags = style.getFlag(keyAttr, R.styleable.Keyboard_Key_keyActionFlags); String[] moreKeys = style.getStringArray(keyAttr, R.styleable.Keyboard_Key_moreKeys); - int column; - if ((column = parseMoreKeysColumnOrder(moreKeys, AUTO_COLUMN_ORDER)) > 0) { - mMaxMoreKeysColumn = column; - } else if ((column = parseMoreKeysColumnOrder(moreKeys, FIXED_COLUMN_ORDER)) > 0) { - mMaxMoreKeysColumn = column | MORE_KEYS_FIXED_COLUMN_ORDER; - } else { - mMaxMoreKeysColumn = style.getInt(keyAttr, - R.styleable.Keyboard_Key_maxMoreKeysColumn, params.mMaxMoreKeysKeyboardColumn); + + int moreKeysColumn = style.getInt(keyAttr, + R.styleable.Keyboard_Key_maxMoreKeysColumn, params.mMaxMoreKeysKeyboardColumn); + int value; + if ((value = KeySpecParser.getIntValue(moreKeys, MORE_KEYS_AUTO_COLUMN_ORDER, -1)) > 0) { + moreKeysColumn = value & MORE_KEYS_COLUMN_MASK; + } + if ((value = KeySpecParser.getIntValue(moreKeys, MORE_KEYS_FIXED_COLUMN_ORDER, -1)) > 0) { + moreKeysColumn = MORE_KEYS_FLAGS_FIXED_COLUMN_ORDER | (value & MORE_KEYS_COLUMN_MASK); + } + if (KeySpecParser.getBooleanValue(moreKeys, MORE_KEYS_HAS_LABELS)) { + moreKeysColumn |= MORE_KEYS_FLAGS_HAS_LABELS; + } + if (KeySpecParser.getBooleanValue(moreKeys, MORE_KEYS_NEEDS_DIVIDERS)) { + moreKeysColumn |= MORE_KEYS_FLAGS_NEEDS_DIVIDERS; } + mMoreKeysColumnAndFlags = moreKeysColumn; + final String[] additionalMoreKeys = style.getStringArray( keyAttr, R.styleable.Keyboard_Key_additionalMoreKeys); moreKeys = KeySpecParser.insertAddtionalMoreKeys(moreKeys, additionalMoreKeys); @@ -311,21 +326,6 @@ public class Key { } } - private static int parseMoreKeysColumnOrder(String[] moreKeys, String key) { - if (moreKeys == null || moreKeys.length == 0 || moreKeys[0] == null - || !moreKeys[0].startsWith(key)) { - return -1; - } - try { - final int column = Integer.parseInt(moreKeys[0].substring(key.length())); - moreKeys[0] = null; - return column; - } catch (NumberFormatException e) { - Log.w(TAG, "column number should follow after " + key); - return 0; - } - } - private static int adjustCaseOfCodeForKeyboardId(int code, boolean preserveCase, KeyboardId id) { if (!Keyboard.isLetterCode(code) || preserveCase) return code; @@ -479,7 +479,7 @@ public class Key { } public int selectTextSize(int letter, int largeLetter, int label, int hintLabel) { - if (mLabel.length() > 1 + if (Utils.codePointCount(mLabel) > 1 && (mLabelFlags & (LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO | LABEL_FLAGS_FOLLOW_KEY_HINT_LABEL_RATIO)) == 0) { return label; @@ -532,6 +532,22 @@ public class Key { return (mLabelFlags & LABEL_FLAGS_SHIFTED_LETTER_ACTIVATED) != 0; } + public int getMoreKeysColumn() { + return mMoreKeysColumnAndFlags & MORE_KEYS_COLUMN_MASK; + } + + public boolean isFixedColumnOrderMoreKeys() { + return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_FIXED_COLUMN_ORDER) != 0; + } + + public boolean hasLabelsInMoreKeys() { + return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_HAS_LABELS) != 0; + } + + public boolean needsDividersInMoreKeys() { + return (mMoreKeysColumnAndFlags & MORE_KEYS_FLAGS_NEEDS_DIVIDERS) != 0; + } + public Drawable getIcon(KeyboardIconsSet iconSet) { return iconSet.getIconDrawable(mIconId); } @@ -682,7 +698,7 @@ public class Key { */ protected Spacer(Keyboard.Params params, int x, int y, int width, int height) { super(params, null, null, KeyboardIconsSet.ICON_UNDEFINED, Keyboard.CODE_UNSPECIFIED, - null, x, y, width, height); + null, x, y, width, height, 0); } } } diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 0ce98d2f1..10cf1d1f4 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -267,7 +267,7 @@ public class KeyDetector { addDelimiter = false; } else { if (addDelimiter) sb.append(", "); - sb.append(code); + sb.append(Keyboard.printableCode(code)); addDelimiter = true; } } diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 30ed59e18..c6cdf7986 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -85,8 +85,6 @@ public class Keyboard { public static final int CODE_CLOSING_SQUARE_BRACKET = ']'; public static final int CODE_CLOSING_CURLY_BRACKET = '}'; public static final int CODE_CLOSING_ANGLE_BRACKET = '>'; - public static final int CODE_DIGIT0 = '0'; - public static final int CODE_PLUS = '+'; private static final int MINIMUM_LETTER_CODE = CODE_TAB; /** Special keys code. Must be negative. @@ -185,18 +183,11 @@ public class Keyboard { } // TODO: Remove this method. - public boolean isShiftLocked() { - return mId.isAlphabetShiftLockedKeyboard(); - } - - // TODO: Remove this method. public boolean isShiftedOrShiftLocked() { - return mId.isAlphabetShiftedOrShiftLockedKeyboard(); - } - - // TODO: Remove this method. - public boolean isManualShifted() { - return mId.isAlphabetManualShiftedKeyboard(); + // Alphabet mode have unshifted, manual shifted, automatic shifted, shift locked, and + // shift lock shifted element. So that unshifed element is the only one that is NOT in + // shifted or shift locked state. + return mId.isAlphabetKeyboard() && mId.mElementId != KeyboardId.ELEMENT_ALPHABET; } public static boolean isLetterCode(int code) { diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardId.java b/java/src/com/android/inputmethod/keyboard/KeyboardId.java index ed4a89e0f..f5752962e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardId.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardId.java @@ -36,6 +36,9 @@ public class KeyboardId { public static final int MODE_IM = 3; public static final int MODE_PHONE = 4; public static final int MODE_NUMBER = 5; + public static final int MODE_DATE = 6; + public static final int MODE_TIME = 7; + public static final int MODE_DATETIME = 8; public static final int ELEMENT_ALPHABET = 0; public static final int ELEMENT_ALPHABET_MANUAL_SHIFTED = 1; @@ -123,31 +126,6 @@ public class KeyboardId { return mElementId < ELEMENT_SYMBOLS; } - public boolean isAlphabetShiftLockedKeyboard() { - return mElementId == ELEMENT_ALPHABET_SHIFT_LOCKED - || mElementId == ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED; - } - - public boolean isAlphabetShiftedOrShiftLockedKeyboard() { - return isAlphabetKeyboard() && mElementId != ELEMENT_ALPHABET; - } - - public boolean isAlphabetManualShiftedKeyboard() { - return mElementId == ELEMENT_ALPHABET_MANUAL_SHIFTED; - } - - public boolean isSymbolsKeyboard() { - return mElementId == ELEMENT_SYMBOLS || mElementId == ELEMENT_SYMBOLS_SHIFTED; - } - - public boolean isPhoneKeyboard() { - return mElementId == ELEMENT_PHONE || mElementId == ELEMENT_PHONE_SYMBOLS; - } - - public boolean isPhoneShiftKeyboard() { - return mElementId == ELEMENT_PHONE_SYMBOLS; - } - public boolean navigateNext() { return EditorInfoCompatUtils.hasFlagNavigateNext(mEditorInfo.imeOptions); } @@ -242,6 +220,9 @@ public class KeyboardId { case MODE_IM: return "im"; case MODE_PHONE: return "phone"; case MODE_NUMBER: return "number"; + case MODE_DATE: return "date"; + case MODE_TIME: return "time"; + case MODE_DATETIME: return "datetime"; default: return null; } } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java index 6e62f743b..ee882edc0 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardSet.java @@ -131,6 +131,9 @@ public class KeyboardSet { } break; case KeyboardId.MODE_NUMBER: + case KeyboardId.MODE_DATE: + case KeyboardId.MODE_TIME: + case KeyboardId.MODE_DATETIME: keyboardSetElementId = KeyboardId.ELEMENT_NUMBER; break; default: diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index d65253ede..78e0ee230 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -849,7 +849,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { final KeyPreviewDrawParams params = mKeyPreviewDrawParams; final int keyDrawX = key.mX + key.mVisualInsetsLeft; final int keyDrawWidth = key.mWidth - key.mVisualInsetsLeft - key.mVisualInsetsRight; - // What we show as preview should match what we show on key top in onBufferDraw(). + // What we show as preview should match what we show on a key top in onBufferDraw(). if (key.mLabel != null) { // TODO Should take care of temporaryShiftLabel here. previewText.setCompoundDrawables(null, null, null, null); diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 00570fb0b..99bd08031 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -41,7 +41,6 @@ import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy; import com.android.inputmethod.deprecated.VoiceProxy; import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy; import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; -import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.R; @@ -80,8 +79,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke private float mSpacebarTextSize; private final int mSpacebarTextColor; private final int mSpacebarTextShadowColor; - // Height in space key the language name will be drawn. (proportional to space key height) - private static final float SPACEBAR_LANGUAGE_BASELINE = 0.6f; // If the full language name needs to be smaller than this value to be drawn on space key, // its short language name will be used instead. private static final float MINIMUM_SCALE_OF_LANGUAGE_NAME = 0.8f; @@ -398,7 +395,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke mMoreKeysPanelCache.clear(); mSpaceKey = keyboard.getKey(Keyboard.CODE_SPACE); - mSpaceIcon = keyboard.mIconsSet.getIconDrawable(KeyboardIconsSet.ICON_SPACE); + mSpaceIcon = (mSpaceKey != null) ? mSpaceKey.getIcon(keyboard.mIconsSet) : null; final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap; mSpacebarTextSize = keyHeight * mSpacebarTextRatio; mSpacebarLocale = keyboard.mId.mLocale; @@ -483,11 +480,13 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke */ protected boolean onLongPress(Key parentKey, PointerTracker tracker) { final int primaryCode = parentKey.mCode; - final Keyboard keyboard = getKeyboard(); - if (primaryCode == Keyboard.CODE_DIGIT0 && keyboard.mId.isPhoneKeyboard()) { + if (parentKey.mMoreKeys == null && !parentKey.altCodeWhileTyping() + && parentKey.mAltCode != Keyboard.CODE_UNSPECIFIED) { + // Long press on a key that has no more keys and not altCodeWhileTyping but altCode + // defined, such as "0 +" key on phone layout and "/ :" key on datetime + // layout. tracker.onLongPressed(); - // Long pressing on 0 in phone number keypad gives you a '+'. - invokeCodeInput(Keyboard.CODE_PLUS); + invokeCodeInput(parentKey.mAltCode); invokeReleaseKey(primaryCode); KeyboardSwitcher.getInstance().hapticAndAudioFeedback(primaryCode); return true; @@ -776,8 +775,6 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke @Override protected void onDrawKeyTopVisuals(Key key, Canvas canvas, Paint paint, KeyDrawParams params) { - super.onDrawKeyTopVisuals(key, canvas, paint, params); - if (key.mCode == Keyboard.CODE_SPACE) { drawSpacebar(key, canvas, paint); @@ -786,6 +783,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke && Utils.hasMultipleEnabledIMEsOrSubtypes(true /* include aux subtypes */)) { drawKeyPopupHint(key, canvas, paint, params); } + } else { + super.onDrawKeyTopVisuals(key, canvas, paint, params); } } @@ -840,7 +839,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke private void drawSpacebar(Key key, Canvas canvas, Paint paint) { final int width = key.mWidth; - final int height = mSpaceIcon != null ? mSpaceIcon.getIntrinsicHeight() : key.mHeight; + final int height = key.mHeight; // If application locales are explicitly selected. if (mNeedsToDisplayLanguage) { @@ -851,8 +850,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke // spacebar. final float descent = paint.descent(); final float textHeight = -paint.ascent() + descent; - final float baseline = (mSpaceIcon != null) ? height * SPACEBAR_LANGUAGE_BASELINE - : height / 2 + textHeight / 2; + final float baseline = height / 2 + textHeight / 2; paint.setColor(getSpacebarTextColor(mSpacebarTextShadowColor, mSpacebarTextFadeFactor)); canvas.drawText(language, width / 2, baseline - descent - 1, paint); paint.setColor(getSpacebarTextColor(mSpacebarTextColor, mSpacebarTextFadeFactor)); diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java index 7d8181dda..9f735cff7 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java @@ -17,9 +17,12 @@ package com.android.inputmethod.keyboard; import android.graphics.Paint; +import android.graphics.drawable.Drawable; import com.android.inputmethod.keyboard.internal.KeySpecParser; +import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; import com.android.inputmethod.latin.R; +import com.android.inputmethod.latin.Utils; public class MoreKeysKeyboard extends Keyboard { private final int mDefaultKeyCoordX; @@ -34,7 +37,11 @@ public class MoreKeysKeyboard extends Keyboard { } public static class Builder extends Keyboard.Builder<Builder.MoreKeysKeyboardParams> { - private final String[] mMoreKeys; + private final Key mParentKey; + private final Drawable mDivider; + + private static final float LABEL_PADDING_RATIO = 0.2f; + private static final float DIVIDER_RATIO = 0.2f; public static class MoreKeysKeyboardParams extends Keyboard.Params { public boolean mIsFixedOrder; @@ -44,33 +51,29 @@ public class MoreKeysKeyboard extends Keyboard { public int mTopKeys; public int mLeftKeys; public int mRightKeys; // includes default key. + public int mDividerWidth; + public int mColumnWidth; public MoreKeysKeyboardParams() { super(); } - /* package for test */MoreKeysKeyboardParams(int numKeys, int maxColumns, int keyWidth, - int rowHeight, int coordXInParent, int parentKeyboardWidth) { - super(); - setParameters(numKeys, maxColumns, keyWidth, rowHeight, coordXInParent, - parentKeyboardWidth); - } - /** * Set keyboard parameters of more keys keyboard. * * @param numKeys number of keys in this more keys keyboard. - * @param maxColumnsAndFlags number of maximum columns of this more keys keyboard. - * This might have {@link Key#MORE_KEYS_FIXED_COLUMN_ORDER} flag. + * @param maxColumns number of maximum columns of this more keys keyboard. * @param keyWidth more keys keyboard key width in pixel, including horizontal gap. * @param rowHeight more keys keyboard row height in pixel, including vertical gap. * @param coordXInParent coordinate x of the key preview in parent keyboard. * @param parentKeyboardWidth parent keyboard width in pixel. + * @param isFixedColumnOrder if true, more keys should be laid out in fixed order. + * @param dividerWidth width of divider, zero for no dividers. */ - public void setParameters(int numKeys, int maxColumnsAndFlags, int keyWidth, - int rowHeight, int coordXInParent, int parentKeyboardWidth) { - mIsFixedOrder = (maxColumnsAndFlags & Key.MORE_KEYS_FIXED_COLUMN_ORDER) != 0; - final int maxColumns = maxColumnsAndFlags & ~Key.MORE_KEYS_FIXED_COLUMN_ORDER; + public void setParameters(int numKeys, int maxColumns, int keyWidth, int rowHeight, + int coordXInParent, int parentKeyboardWidth, boolean isFixedColumnOrder, + int dividerWidth) { + mIsFixedOrder = isFixedColumnOrder; if (parentKeyboardWidth / keyWidth < maxColumns) { throw new IllegalArgumentException( "Keyboard is too small to hold more keys keyboard: " @@ -121,7 +124,9 @@ public class MoreKeysKeyboard extends Keyboard { // Adjustment of the top row. mTopRowAdjustment = mIsFixedOrder ? getFixedOrderTopRowAdjustment() : getAutoOrderTopRowAdjustment(); - mBaseWidth = mOccupiedWidth = mNumColumns * mDefaultKeyWidth; + mDividerWidth = dividerWidth; + mColumnWidth = mDefaultKeyWidth + mDividerWidth; + mBaseWidth = mOccupiedWidth = mNumColumns * mColumnWidth - mDividerWidth; // Need to subtract the bottom row's gutter only. mBaseHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight - mVerticalGap + mTopPadding + mBottomPadding; @@ -219,13 +224,13 @@ public class MoreKeysKeyboard extends Keyboard { } public int getDefaultKeyCoordX() { - return mLeftKeys * mDefaultKeyWidth; + return mLeftKeys * mColumnWidth; } public int getX(int n, int row) { - final int x = getColumnPos(n) * mDefaultKeyWidth + getDefaultKeyCoordX(); + final int x = getColumnPos(n) * mColumnWidth + getDefaultKeyCoordX(); if (isTopRow(row)) { - return x + mTopRowAdjustment * (mDefaultKeyWidth / 2); + return x + mTopRowAdjustment * (mColumnWidth / 2); } return x; } @@ -253,7 +258,7 @@ public class MoreKeysKeyboard extends Keyboard { // TODO: More keys keyboard's vertical gap is currently calculated heuristically. // Should revise the algorithm. mParams.mVerticalGap = parentKeyboard.mVerticalGap / 2; - mMoreKeys = parentKey.mMoreKeys; + mParentKey = parentKey; final int previewWidth = view.mKeyPreviewDrawParams.mPreviewBackgroundWidth; final int previewHeight = view.mKeyPreviewDrawParams.mPreviewBackgroundHeight; @@ -261,27 +266,42 @@ public class MoreKeysKeyboard extends Keyboard { // Use pre-computed width and height if these values are available and more keys // keyboard has only one key to mitigate visual flicker between key preview and more // keys keyboard. - if (view.isKeyPreviewPopupEnabled() && mMoreKeys.length == 1 && previewWidth > 0 - && previewHeight > 0) { + final boolean validKeyPreview = view.isKeyPreviewPopupEnabled() + && !parentKey.noKeyPreview() && (previewWidth > 0) && (previewHeight > 0); + final boolean singleMoreKeyWithPreview = validKeyPreview + && parentKey.mMoreKeys.length == 1; + if (singleMoreKeyWithPreview) { width = previewWidth; height = previewHeight + mParams.mVerticalGap; } else { - width = getMaxKeyWidth(view, parentKey.mMoreKeys, mParams.mDefaultKeyWidth); + width = getMaxKeyWidth(view, parentKey, mParams.mDefaultKeyWidth); height = parentKeyboard.mMostCommonKeyHeight; } - mParams.setParameters(mMoreKeys.length, parentKey.mMaxMoreKeysColumn, width, height, - parentKey.mX + parentKey.mWidth / 2, view.getMeasuredWidth()); + final int dividerWidth; + if (parentKey.needsDividersInMoreKeys()) { + mDivider = mResources.getDrawable(R.drawable.more_keys_divider); + // TODO: Drawable itself should have an alpha value. + mDivider.setAlpha(128); + dividerWidth = (int)(width * DIVIDER_RATIO); + } else { + mDivider = null; + dividerWidth = 0; + } + mParams.setParameters(parentKey.mMoreKeys.length, parentKey.getMoreKeysColumn(), + width, height, parentKey.mX + parentKey.mWidth / 2, view.getMeasuredWidth(), + parentKey.isFixedColumnOrderMoreKeys(), dividerWidth); } - private static int getMaxKeyWidth(KeyboardView view, String[] moreKeys, int minKeyWidth) { - final int padding = (int) view.getContext().getResources() - .getDimension(R.dimen.more_keys_keyboard_key_horizontal_padding); + private static int getMaxKeyWidth(KeyboardView view, Key parentKey, int minKeyWidth) { + final int padding = (int)(view.getResources() + .getDimension(R.dimen.more_keys_keyboard_key_horizontal_padding) + + (parentKey.hasLabelsInMoreKeys() ? minKeyWidth * LABEL_PADDING_RATIO : 0)); Paint paint = null; int maxWidth = minKeyWidth; - for (String moreKeySpec : moreKeys) { + for (String moreKeySpec : parentKey.mMoreKeys) { final String label = KeySpecParser.getLabel(moreKeySpec); // If the label is single letter, minKeyWidth is enough to hold the label. - if (label != null && label.length() > 1) { + if (label != null && Utils.codePointCount(label) > 1) { if (paint == null) { paint = new Paint(); paint.setAntiAlias(true); @@ -295,16 +315,48 @@ public class MoreKeysKeyboard extends Keyboard { return maxWidth; } + private static class MoreKeyDivider extends Key.Spacer { + private final Drawable mIcon; + + public MoreKeyDivider(MoreKeysKeyboardParams params, Drawable icon, int x, int y) { + super(params, x, y, params.mDividerWidth, params.mDefaultRowHeight); + mIcon = icon; + } + + @Override + public Drawable getIcon(KeyboardIconsSet iconSet) { + // KeyboardIconsSet is unused. Use the icon that has been passed to the constructor. + return mIcon; + } + } + @Override public MoreKeysKeyboard build() { final MoreKeysKeyboardParams params = mParams; - for (int n = 0; n < mMoreKeys.length; n++) { - final String moreKeySpec = mMoreKeys[n]; + // moreKeyFlags == 0 means that the rendered text size will be determined by its + // label's code point count. + final int moreKeyFlags = mParentKey.hasLabelsInMoreKeys() ? 0 + : Key.LABEL_FLAGS_FOLLOW_KEY_LETTER_RATIO; + final String[] moreKeys = mParentKey.mMoreKeys; + for (int n = 0; n < moreKeys.length; n++) { + final String moreKeySpec = moreKeys[n]; final int row = n / params.mNumColumns; - final Key key = new Key(mResources, params, moreKeySpec, params.getX(n, row), - params.getY(row), params.mDefaultKeyWidth, params.mDefaultRowHeight); + final int x = params.getX(n, row); + final int y = params.getY(row); + final Key key = new Key(mResources, params, moreKeySpec, x, y, + params.mDefaultKeyWidth, params.mDefaultRowHeight, moreKeyFlags); params.markAsEdgeKey(key, row); params.onAddKey(key); + + final int pos = params.getColumnPos(n); + // The "pos" value represents the offset from the default position. Negative means + // left of the default position. + if (params.mDividerWidth > 0 && pos != 0) { + final int dividerX = (pos > 0) ? x - params.mDividerWidth + : x + params.mDefaultKeyWidth; + final Key divider = new MoreKeyDivider(params, mDivider, dividerX, y); + params.onAddKey(divider); + } } return new MoreKeysKeyboard(params); } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java index f61eefda5..e3fea3dce 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeySpecParser.java @@ -426,4 +426,44 @@ public class KeySpecParser { return list.toArray(new String[list.size()]); } } + + public static int getIntValue(String[] moreKeys, String key, int defaultValue) { + if (moreKeys == null) { + return defaultValue; + } + boolean foundValue = false; + int value = defaultValue; + for (int i = 0; i < moreKeys.length; i++) { + final String moreKeySpec = moreKeys[i]; + if (moreKeySpec == null || !moreKeySpec.startsWith(key)) { + continue; + } + moreKeys[i] = null; + try { + if (!foundValue) { + value = Integer.parseInt(moreKeySpec.substring(key.length())); + } + } catch (NumberFormatException e) { + throw new RuntimeException( + "integer should follow after " + key + ": " + moreKeySpec); + } + } + return value; + } + + public static boolean getBooleanValue(String[] moreKeys, String key) { + if (moreKeys == null) { + return false; + } + boolean value = false; + for (int i = 0; i < moreKeys.length; i++) { + final String moreKeySpec = moreKeys[i]; + if (moreKeySpec == null || !moreKeySpec.equals(key)) { + continue; + } + moreKeys[i] = null; + value = true; + } + return value; + } } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java index 162e96d06..7c8fd1225 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardIconsSet.java @@ -29,9 +29,8 @@ import java.util.Map; public class KeyboardIconsSet { private static final String TAG = KeyboardIconsSet.class.getSimpleName(); - public static final int ICON_UNDEFINED = 0; // The value should be aligned with the enum value of Key.keyIcon. - public static final int ICON_SPACE = 4; + public static final int ICON_UNDEFINED = 0; private static final int NUM_ICONS = 13; private final Drawable[] mIcons = new Drawable[NUM_ICONS + 1]; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java index 6a8a03677..18a3f9794 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java @@ -546,16 +546,19 @@ public class KeyboardState { || code == Keyboard.CODE_OUTPUT_TEXT)) { mSwitchState = SWITCH_STATE_SYMBOL; } - // Switch back to alpha keyboard mode immediately if user types a quote character. + // Switch back to alpha keyboard mode immediately if user types one of the switch back + // characters. if (isLayoutSwitchBackCharacter(code)) { toggleAlphabetAndSymbols(); + mPrevSymbolsKeyboardWasShifted = false; } break; case SWITCH_STATE_SYMBOL: // Switch back to alpha keyboard mode if user types one or more non-space/enter - // characters followed by a space/enter or a quote character. + // characters followed by a space/enter or one of the switch back characters. if (isSpaceCharacter(code) || isLayoutSwitchBackCharacter(code)) { toggleAlphabetAndSymbols(); + mPrevSymbolsKeyboardWasShifted = false; } break; } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 47ec40f99..98bdef606 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -242,7 +242,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar public final UIHandler mHandler = new UIHandler(this); public static class UIHandler extends StaticInnerHandlerWrapper<LatinIME> { - private static final int MSG_UPDATE_SUGGESTIONS = 0; private static final int MSG_UPDATE_SHIFT_STATE = 1; private static final int MSG_VOICE_RESULTS = 2; private static final int MSG_FADEOUT_LANGUAGE_ON_SPACEBAR = 3; @@ -250,6 +249,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private static final int MSG_SPACE_TYPED = 5; private static final int MSG_SET_BIGRAM_PREDICTIONS = 6; private static final int MSG_PENDING_IMS_CALLBACK = 7; + private static final int MSG_UPDATE_SUGGESTIONS = 8; private int mDelayBeforeFadeoutLanguageOnSpacebar; private int mDelayUpdateSuggestions; @@ -979,7 +979,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar .setTypedWordValid(false) .setHasMinimalSuggestion(false); // When in fullscreen mode, show completions generated by the application - setSuggestions(builder.build()); + final SuggestedWords words = builder.build(); + final boolean isAutoCorrection = Utils.willAutoCorrect(words); + setSuggestions(words, isAutoCorrection); + setAutoCorrectionIndicator(isAutoCorrection); // TODO: is this the right thing to do? What should we auto-correct to in // this case? This says to keep whatever the user typed. mWordComposer.setAutoCorrection(mWordComposer.getTypedWord()); @@ -1712,22 +1715,23 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void clearSuggestions() { - setSuggestions(SuggestedWords.EMPTY); + setSuggestions(SuggestedWords.EMPTY, false); + setAutoCorrectionIndicator(false); } - public void setSuggestions(SuggestedWords words) { + public void setSuggestions(final SuggestedWords words, final boolean isAutoCorrection) { if (mSuggestionsView != null) { mSuggestionsView.setSuggestions(words); - mKeyboardSwitcher.onAutoCorrectionStateChanged( - words.hasWordAboveAutoCorrectionScoreThreshold()); + mKeyboardSwitcher.onAutoCorrectionStateChanged(isAutoCorrection); } + } + private void setAutoCorrectionIndicator(final boolean newAutoCorrectionIndicator) { // Put a blue underline to a word in TextView which will be auto-corrected. final InputConnection ic = getCurrentInputConnection(); if (ic != null) { final boolean oldAutoCorrectionIndicator = mComposingStateManager.isAutoCorrectionIndicatorOn(); - final boolean newAutoCorrectionIndicator = Utils.willAutoCorrect(words); if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) { mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator); if (DEBUG) { @@ -1738,9 +1742,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar throw new RuntimeException("Couldn't flip the indicator!"); } } - final CharSequence textWithUnderline = - getTextWithUnderline(mWordComposer.getTypedWord()); - if (!TextUtils.isEmpty(textWithUnderline)) { + if (mWordComposer.isComposingWord()) { + final CharSequence textWithUnderline = + getTextWithUnderline(mWordComposer.getTypedWord()); ic.setComposingText(textWithUnderline, 1); } } @@ -1830,25 +1834,26 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar showSuggestions(builder.build(), typedWord); } - public void showSuggestions(SuggestedWords suggestedWords, CharSequence typedWord) { + public void showSuggestions(final SuggestedWords suggestedWords, final CharSequence typedWord) { final boolean shouldBlockAutoCorrectionBySafetyNet = Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords, mSuggest); if (shouldBlockAutoCorrectionBySafetyNet) { suggestedWords.setShouldBlockAutoCorrection(); } - setSuggestions(suggestedWords); + final CharSequence autoCorrection; if (suggestedWords.size() > 0) { - if (shouldBlockAutoCorrectionBySafetyNet) { - mWordComposer.setAutoCorrection(typedWord); - } else if (suggestedWords.hasAutoCorrectionWord()) { - mWordComposer.setAutoCorrection(suggestedWords.getWord(1)); + if (!shouldBlockAutoCorrectionBySafetyNet && suggestedWords.hasAutoCorrectionWord()) { + autoCorrection = suggestedWords.getWord(1); } else { - mWordComposer.setAutoCorrection(typedWord); + autoCorrection = typedWord; } } else { - // TODO: replace with mWordComposer.deleteAutoCorrection()? - mWordComposer.setAutoCorrection(null); + autoCorrection = null; } + mWordComposer.setAutoCorrection(autoCorrection); + final boolean isAutoCorrection = Utils.willAutoCorrect(suggestedWords); + setSuggestions(suggestedWords, isAutoCorrection); + setAutoCorrectionIndicator(isAutoCorrection); setSuggestionStripShown(isSuggestionsStripVisible()); } @@ -2021,7 +2026,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } public void setPunctuationSuggestions() { - setSuggestions(mSettingsValues.mSuggestPuncList); + setSuggestions(mSettingsValues.mSuggestPuncList, false); + setAutoCorrectionIndicator(false); setSuggestionStripShown(isSuggestionsStripVisible()); } diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index ed6359cfa..993ae3b42 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -65,10 +65,6 @@ public class SuggestedWords { return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid; } - public boolean hasWordAboveAutoCorrectionScoreThreshold() { - return mHasAutoCorrectionCandidate && ((size() > 1 && !mTypedWordValid) || mTypedWordValid); - } - public boolean isPunctuationSuggestions() { return mIsPunctuationSuggestions; } diff --git a/java/src/com/android/inputmethod/latin/UserBigramDictionary.java b/java/src/com/android/inputmethod/latin/UserBigramDictionary.java index f80534cb5..e6a59d0ab 100644 --- a/java/src/com/android/inputmethod/latin/UserBigramDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserBigramDictionary.java @@ -212,7 +212,8 @@ public class UserBigramDictionary extends ExpandableDictionary { @Override public void loadDictionaryAsync() { // Load the words that correspond to the current input locale - Cursor cursor = query(MAIN_COLUMN_LOCALE + "=?", new String[] { mLocale }); + final Cursor cursor = query(MAIN_COLUMN_LOCALE + "=?", new String[] { mLocale }); + if (null == cursor) return; try { if (cursor.moveToFirst()) { int word1Index = cursor.getColumnIndex(MAIN_COLUMN_WORD1); @@ -249,11 +250,17 @@ public class UserBigramDictionary extends ExpandableDictionary { qb.setProjectionMap(sDictProjectionMap); // Get the database and run the query - SQLiteDatabase db = sOpenHelper.getReadableDatabase(); - Cursor c = qb.query(db, - new String[] { MAIN_COLUMN_WORD1, MAIN_COLUMN_WORD2, FREQ_COLUMN_FREQUENCY }, - selection, selectionArgs, null, null, null); - return c; + try { + SQLiteDatabase db = sOpenHelper.getReadableDatabase(); + Cursor c = qb.query(db, + new String[] { MAIN_COLUMN_WORD1, MAIN_COLUMN_WORD2, FREQ_COLUMN_FREQUENCY }, + selection, selectionArgs, null, null, null); + return c; + } catch (android.database.sqlite.SQLiteCantOpenDatabaseException e) { + // Can't open the database : presumably we can't access storage. That may happen + // when the device is wedged; do a best effort to still start the keyboard. + return null; + } } /** @@ -344,7 +351,18 @@ public class UserBigramDictionary extends ExpandableDictionary { @Override protected Void doInBackground(Void... v) { - SQLiteDatabase db = mDbHelper.getWritableDatabase(); + SQLiteDatabase db = null; + try { + db = mDbHelper.getWritableDatabase(); + } catch (android.database.sqlite.SQLiteCantOpenDatabaseException e) { + // If we can't open the db, don't do anything. Exit through the next test + // for non-nullity of the db variable. + } + if (null == db) { + // Not much we can do. Just exit. + sUpdatingDB = false; + return null; + } db.execSQL("PRAGMA foreign_keys = ON;"); // Write all the entries to the db Iterator<Bigram> iterator = mMap.iterator(); diff --git a/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java b/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java index a7f57ae46..869865d7b 100644 --- a/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java @@ -121,7 +121,8 @@ public class UserUnigramDictionary extends ExpandableDictionary { public void loadDictionaryAsync() { if (!ENABLE_USER_UNIGRAM_DICTIONARY) return; // Load the words that correspond to the current input locale - Cursor cursor = query(COLUMN_LOCALE + "=?", new String[] { mLocale }); + final Cursor cursor = query(COLUMN_LOCALE + "=?", new String[] { mLocale }); + if (null == cursor) return; try { if (cursor.moveToFirst()) { int wordIndex = cursor.getColumnIndex(COLUMN_WORD); @@ -212,10 +213,16 @@ public class UserUnigramDictionary extends ExpandableDictionary { qb.setProjectionMap(sDictProjectionMap); // Get the database and run the query - SQLiteDatabase db = sOpenHelper.getReadableDatabase(); - Cursor c = qb.query(db, null, selection, selectionArgs, null, null, - DEFAULT_SORT_ORDER); - return c; + try { + SQLiteDatabase db = sOpenHelper.getReadableDatabase(); + Cursor c = qb.query(db, null, selection, selectionArgs, null, null, + DEFAULT_SORT_ORDER); + return c; + } catch (android.database.sqlite.SQLiteCantOpenDatabaseException e) { + // Can't open the database : presumably we can't access storage. That may happen + // when the device is wedged; do a best effort to still start the keyboard. + return null; + } } /** @@ -236,7 +243,14 @@ public class UserUnigramDictionary extends ExpandableDictionary { @Override protected Void doInBackground(Void... v) { - SQLiteDatabase db = mDbHelper.getWritableDatabase(); + SQLiteDatabase db = null; + try { + db = mDbHelper.getWritableDatabase(); + } catch (android.database.sqlite.SQLiteCantOpenDatabaseException e) { + // With no access to the DB, this is moot. Do nothing: we'll exit through the + // test for null == db. + } + if (null == db) return null; // Write all the entries to the db Set<Entry<String,Integer>> mEntries = mMap.entrySet(); for (Entry<String,Integer> entry : mEntries) { diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index 6d63e95f6..47ea9ee8a 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -563,8 +563,16 @@ public class Utils { switch (inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: - case InputType.TYPE_CLASS_DATETIME: return KeyboardId.MODE_NUMBER; + case InputType.TYPE_CLASS_DATETIME: + switch (variation) { + case InputType.TYPE_DATETIME_VARIATION_DATE: + return KeyboardId.MODE_DATE; + case InputType.TYPE_DATETIME_VARIATION_TIME: + return KeyboardId.MODE_TIME; + default: // InputType.TYPE_DATETIME_VARIATION_NORMAL + return KeyboardId.MODE_DATETIME; + } case InputType.TYPE_CLASS_PHONE: return KeyboardId.MODE_PHONE; case InputType.TYPE_CLASS_TEXT: diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java index 4ef5bd386..cb1b49c67 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java +++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java @@ -34,7 +34,7 @@ import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; public class MoreSuggestions extends Keyboard { public static final int SUGGESTION_CODE_BASE = 1024; - private MoreSuggestions(Builder.MoreSuggestionsParam params) { + MoreSuggestions(Builder.MoreSuggestionsParam params) { super(params); } @@ -63,7 +63,7 @@ public class MoreSuggestions extends Keyboard { paint.setAntiAlias(true); final Resources res = view.getContext().getResources(); mDivider = res.getDrawable(R.drawable.more_suggestions_divider); - // TODO: Drawable itself should has an alpha value. + // TODO: Drawable itself should have an alpha value. mDivider.setAlpha(128); mDividerWidth = mDivider.getIntrinsicWidth(); final int padding = (int) res.getDimension( @@ -227,7 +227,7 @@ public class MoreSuggestions extends Keyboard { final int index = pos + SUGGESTION_CODE_BASE; final Key key = new Key( params, word, info, KeyboardIconsSet.ICON_UNDEFINED, index, null, x, y, - width, params.mDefaultRowHeight); + width, params.mDefaultRowHeight, 0); params.markAsEdgeKey(key, pos); params.onAddKey(key); final int columnNumber = params.getColumnNumber(pos); |