diff options
Diffstat (limited to 'java/src')
18 files changed, 334 insertions, 304 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityLongPressTimer.java b/java/src/com/android/inputmethod/accessibility/AccessibilityLongPressTimer.java index 967cafad0..37d910edb 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityLongPressTimer.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityLongPressTimer.java @@ -26,7 +26,7 @@ import com.android.inputmethod.latin.R; // Handling long press timer to show a more keys keyboard. final class AccessibilityLongPressTimer extends Handler { public interface LongPressTimerCallback { - public void onLongPressed(Key key); + public void performLongClickOn(Key key); } private static final int MSG_LONG_PRESS = 1; @@ -47,7 +47,7 @@ final class AccessibilityLongPressTimer extends Handler { switch (msg.what) { case MSG_LONG_PRESS: cancelLongPress(); - mCallback.onLongPressed((Key)msg.obj); + mCallback.performLongClickOn((Key)msg.obj); return; default: super.handleMessage(msg); diff --git a/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java b/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java index 3925fc652..237117d10 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java +++ b/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java @@ -17,9 +17,9 @@ package com.android.inputmethod.accessibility; import android.content.Context; +import android.os.SystemClock; import android.support.v4.view.AccessibilityDelegateCompat; import android.support.v4.view.ViewCompat; -import android.support.v4.view.accessibility.AccessibilityEventCompat; import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; import android.util.Log; import android.view.MotionEvent; @@ -31,7 +31,6 @@ import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.KeyDetector; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardView; -import com.android.inputmethod.keyboard.PointerTracker; /** * This class represents a delegate that can be registered in a class that extends @@ -51,7 +50,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> protected final KV mKeyboardView; protected final KeyDetector mKeyDetector; private Keyboard mKeyboard; - private KeyboardAccessibilityNodeProvider mAccessibilityNodeProvider; + private KeyboardAccessibilityNodeProvider<KV> mAccessibilityNodeProvider; private Key mLastHoverKey; public static final int HOVER_EVENT_POINTER_ID = 0; @@ -134,19 +133,20 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> * @return The accessibility node provider for the current keyboard. */ @Override - public KeyboardAccessibilityNodeProvider getAccessibilityNodeProvider(final View host) { + public KeyboardAccessibilityNodeProvider<KV> getAccessibilityNodeProvider(final View host) { return getAccessibilityNodeProvider(); } /** * @return A lazily-instantiated node provider for this view delegate. */ - protected KeyboardAccessibilityNodeProvider getAccessibilityNodeProvider() { + protected KeyboardAccessibilityNodeProvider<KV> getAccessibilityNodeProvider() { // Instantiate the provide only when requested. Since the system // will call this method multiple times it is a good practice to // cache the provider instance. if (mAccessibilityNodeProvider == null) { - mAccessibilityNodeProvider = new KeyboardAccessibilityNodeProvider(mKeyboardView); + mAccessibilityNodeProvider = + new KeyboardAccessibilityNodeProvider<>(mKeyboardView, this); } return mAccessibilityNodeProvider; } @@ -243,57 +243,42 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> // Make sure we're not getting an EXIT event because the user slid // off the keyboard area, then force a key press. if (key != null) { - onRegisterHoverKey(key, event); + performClickOn(key); onHoverExitFrom(key); } setLastHoverKey(null); } /** - * Register a key that is selected by a hover event + * Perform click on a key. * * @param key A key to be registered. - * @param event A hover exit event that triggers key registering. */ - protected void onRegisterHoverKey(final Key key, final MotionEvent event) { + public void performClickOn(final Key key) { if (DEBUG_HOVER) { - Log.d(TAG, "onRegisterHoverKey: key=" + key); + Log.d(TAG, "performClickOn: key=" + key); } - simulateTouchEvent(MotionEvent.ACTION_DOWN, event); - simulateTouchEvent(MotionEvent.ACTION_UP, event); + simulateTouchEvent(MotionEvent.ACTION_DOWN, key); + simulateTouchEvent(MotionEvent.ACTION_UP, key); } /** - * Simulating a touch event by injecting a synthesized touch event into {@link PointerTracker}. + * Simulating a touch event by injecting a synthesized touch event into {@link KeyboardView}. * * @param touchAction The action of the synthesizing touch event. - * @param hoverEvent The base hover event from that the touch event is synthesized. + * @param key The key that a synthesized touch event is on. */ - protected void simulateTouchEvent(final int touchAction, final MotionEvent hoverEvent) { - final MotionEvent touchEvent = synthesizeTouchEvent(touchAction, hoverEvent); - final int actionIndex = touchEvent.getActionIndex(); - final int pointerId = touchEvent.getPointerId(actionIndex); - final PointerTracker tracker = PointerTracker.getPointerTracker(pointerId); - tracker.processMotionEvent(touchEvent, mKeyDetector); + private void simulateTouchEvent(final int touchAction, final Key key) { + final int x = key.getHitBox().centerX(); + final int y = key.getHitBox().centerY(); + final long eventTime = SystemClock.uptimeMillis(); + final MotionEvent touchEvent = MotionEvent.obtain( + eventTime, eventTime, touchAction, x, y, 0 /* metaState */); + mKeyboardView.onTouchEvent(touchEvent); touchEvent.recycle(); } /** - * Synthesize a touch event from a hover event. - * - * @param touchAction The action of the synthesizing touch event. - * @param hoverEvent The base hover event from that the touch event is synthesized. - * @return The synthesized touch event of <code>touchAction</code> that has pointer information - * of <code>event</code>. - */ - protected static MotionEvent synthesizeTouchEvent(final int touchAction, - final MotionEvent hoverEvent) { - final MotionEvent touchEvent = MotionEvent.obtain(hoverEvent); - touchEvent.setAction(touchAction); - return touchEvent; - } - - /** * Handles a hover enter event on a key. * * @param key The currently hovered key. @@ -304,7 +289,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> } key.onPressed(); mKeyboardView.invalidateKey(key); - final KeyboardAccessibilityNodeProvider provider = getAccessibilityNodeProvider(); + final KeyboardAccessibilityNodeProvider<KV> provider = getAccessibilityNodeProvider(); provider.onHoverEnterTo(key); provider.performActionForKey(key, AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS); } @@ -327,7 +312,16 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> } key.onReleased(); mKeyboardView.invalidateKey(key); - final KeyboardAccessibilityNodeProvider provider = getAccessibilityNodeProvider(); + final KeyboardAccessibilityNodeProvider<KV> provider = getAccessibilityNodeProvider(); provider.onHoverExitFrom(key); } + + /** + * Perform long click on a key. + * + * @param key A key to be long pressed on. + */ + public void performLongClickOn(final Key key) { + // A extended class should override this method to implement long press. + } } diff --git a/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityNodeProvider.java b/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityNodeProvider.java index 61d066af5..66b0acb2f 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityNodeProvider.java +++ b/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityNodeProvider.java @@ -47,7 +47,8 @@ import java.util.List; * virtual views, thus conveying their logical structure. * </p> */ -final class KeyboardAccessibilityNodeProvider extends AccessibilityNodeProviderCompat { +final class KeyboardAccessibilityNodeProvider<KV extends KeyboardView> + extends AccessibilityNodeProviderCompat { private static final String TAG = KeyboardAccessibilityNodeProvider.class.getSimpleName(); // From {@link android.view.accessibility.AccessibilityNodeInfo#UNDEFINED_ITEM_ID}. @@ -68,17 +69,21 @@ final class KeyboardAccessibilityNodeProvider extends AccessibilityNodeProviderC /** The virtual view identifier for the hovering node. */ private int mHoveringNodeId = UNDEFINED; - /** The current keyboard view. */ - private final KeyboardView mKeyboardView; + /** The keyboard view to provide an accessibility node info. */ + private final KV mKeyboardView; + /** The accessibility delegate. */ + private final KeyboardAccessibilityDelegate<KV> mDelegate; /** The current keyboard. */ private Keyboard mKeyboard; - public KeyboardAccessibilityNodeProvider(final KeyboardView keyboardView) { + public KeyboardAccessibilityNodeProvider(final KV keyboardView, + final KeyboardAccessibilityDelegate<KV> delegate) { super(); mKeyCodeDescriptionMapper = KeyCodeDescriptionMapper.getInstance(); mAccessibilityUtils = AccessibilityUtils.getInstance(); mKeyboardView = keyboardView; + mDelegate = delegate; // Since this class is constructed lazily, we might not get a subsequent // call to setKeyboard() and therefore need to call it now. @@ -287,9 +292,11 @@ final class KeyboardAccessibilityNodeProvider extends AccessibilityNodeProviderC return true; case AccessibilityNodeInfoCompat.ACTION_CLICK: sendAccessibilityEventForKey(key, AccessibilityEvent.TYPE_VIEW_CLICKED); + mDelegate.performClickOn(key); return true; case AccessibilityNodeInfoCompat.ACTION_LONG_CLICK: sendAccessibilityEventForKey(key, AccessibilityEvent.TYPE_VIEW_LONG_CLICKED); + mDelegate.performLongClickOn(key); return true; default: return false; diff --git a/java/src/com/android/inputmethod/accessibility/MainKeyboardAccessibilityDelegate.java b/java/src/com/android/inputmethod/accessibility/MainKeyboardAccessibilityDelegate.java index 96f84dde9..b84d402fb 100644 --- a/java/src/com/android/inputmethod/accessibility/MainKeyboardAccessibilityDelegate.java +++ b/java/src/com/android/inputmethod/accessibility/MainKeyboardAccessibilityDelegate.java @@ -207,11 +207,11 @@ public final class MainKeyboardAccessibilityDelegate } @Override - protected void onRegisterHoverKey(final Key key, final MotionEvent event) { + public void performClickOn(final Key key) { final int x = key.getHitBox().centerX(); final int y = key.getHitBox().centerY(); if (DEBUG_HOVER) { - Log.d(TAG, "onRegisterHoverKey: key=" + key + Log.d(TAG, "performClickOn: key=" + key + " inIgnoreBounds=" + mBoundsToIgnoreHoverEvent.contains(x, y)); } if (mBoundsToIgnoreHoverEvent.contains(x, y)) { @@ -220,7 +220,7 @@ public final class MainKeyboardAccessibilityDelegate mBoundsToIgnoreHoverEvent.setEmpty(); return; } - super.onRegisterHoverKey(key, event); + super.performClickOn(key); } @Override @@ -257,9 +257,9 @@ public final class MainKeyboardAccessibilityDelegate } @Override - public void onLongPressed(final Key key) { + public void performLongClickOn(final Key key) { if (DEBUG_HOVER) { - Log.d(TAG, "onLongPressed: key=" + key); + Log.d(TAG, "performLongClickOn: key=" + key); } final PointerTracker tracker = PointerTracker.getPointerTracker(HOVER_EVENT_POINTER_ID); final long eventTime = SystemClock.uptimeMillis(); diff --git a/java/src/com/android/inputmethod/accessibility/MoreSuggestionsAccessibilityDelegate.java b/java/src/com/android/inputmethod/accessibility/MoreSuggestionsAccessibilityDelegate.java deleted file mode 100644 index dfc866113..000000000 --- a/java/src/com/android/inputmethod/accessibility/MoreSuggestionsAccessibilityDelegate.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.accessibility; - -import android.view.MotionEvent; - -import com.android.inputmethod.keyboard.KeyDetector; -import com.android.inputmethod.keyboard.MoreKeysKeyboardView; - -public final class MoreSuggestionsAccessibilityDelegate - extends MoreKeysKeyboardAccessibilityDelegate { - public MoreSuggestionsAccessibilityDelegate(final MoreKeysKeyboardView moreKeysKeyboardView, - final KeyDetector keyDetector) { - super(moreKeysKeyboardView, keyDetector); - } - - @Override - protected void simulateTouchEvent(final int touchAction, final MotionEvent hoverEvent) { - final MotionEvent touchEvent = synthesizeTouchEvent(touchAction, hoverEvent); - mKeyboardView.onTouchEvent(touchEvent); - touchEvent.recycle(); - } -} diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java index 3e5cfc11a..7ba3b3bd5 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardLayoutSet.java @@ -40,6 +40,7 @@ import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.utils.InputTypeUtils; +import com.android.inputmethod.latin.utils.ScriptUtils; import com.android.inputmethod.latin.utils.SubtypeLocaleUtils; import com.android.inputmethod.latin.utils.XmlParseUtils; @@ -63,6 +64,7 @@ public final class KeyboardLayoutSet { private static final String TAG_KEYBOARD_SET = "KeyboardLayoutSet"; private static final String TAG_ELEMENT = "Element"; + private static final String TAG_FEATURE = "Feature"; private static final String KEYBOARD_LAYOUT_SET_RESOURCE_PREFIX = "keyboard_layout_set_"; @@ -111,6 +113,7 @@ public final class KeyboardLayoutSet { boolean mIsSpellChecker; int mKeyboardWidth; int mKeyboardHeight; + int mScriptId; // Sparse array of KeyboardLayoutSet element parameters indexed by element's id. final SparseArray<ElementParams> mKeyboardLayoutSetElementIdToParamsMap = new SparseArray<>(); @@ -275,6 +278,10 @@ public final class KeyboardLayoutSet { mParams.mDisableTouchPositionCorrectionDataForTest = true; } + public void setScriptId(final int scriptId) { + mParams.mScriptId = scriptId; + } + public KeyboardLayoutSet build() { if (mParams.mSubtype == null) throw new RuntimeException("KeyboardLayoutSet subtype is not specified"); @@ -320,6 +327,8 @@ public final class KeyboardLayoutSet { final String tag = parser.getName(); if (TAG_ELEMENT.equals(tag)) { parseKeyboardLayoutSetElement(parser); + } else if (TAG_FEATURE.equals(tag)) { + parseKeyboardLayoutSetFeature(parser); } else { throw new XmlParseUtils.IllegalStartTag(parser, tag, TAG_KEYBOARD_SET); } @@ -361,6 +370,21 @@ public final class KeyboardLayoutSet { } } + private void parseKeyboardLayoutSetFeature(final XmlPullParser parser) + throws XmlPullParserException, IOException { + final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser), + R.styleable.KeyboardLayoutSet_Feature); + try { + final int scriptId = a.getInt( + R.styleable.KeyboardLayoutSet_Feature_supportedScript, + ScriptUtils.SCRIPT_LATIN); + XmlParseUtils.checkEndTag(TAG_FEATURE, parser); + setScriptId(scriptId); + } finally { + a.recycle(); + } + } + private static int getKeyboardMode(final EditorInfo editorInfo) { final int inputType = editorInfo.inputType; final int variation = inputType & InputType.TYPE_MASK_VARIATION; diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index 3994487aa..5140c4ffc 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -126,7 +126,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel @Override public void onDownEvent(final int x, final int y, final int pointerId, final long eventTime) { mActivePointerId = pointerId; - mCurrentKey = detectKey(x, y, pointerId); + mCurrentKey = detectKey(x, y); } @Override @@ -135,7 +135,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel return; } final boolean hasOldKey = (mCurrentKey != null); - mCurrentKey = detectKey(x, y, pointerId); + mCurrentKey = detectKey(x, y); if (hasOldKey && mCurrentKey == null) { // A more keys keyboard is canceled when detecting no key. mController.onCancelMoreKeysPanel(); @@ -149,7 +149,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel } // Calling {@link #detectKey(int,int,int)} here is harmless because the last move event and // the following up event share the same coordinates. - mCurrentKey = detectKey(x, y, pointerId); + mCurrentKey = detectKey(x, y); if (mCurrentKey != null) { updateReleaseKeyGraphics(mCurrentKey); onKeyInput(mCurrentKey, x, y); @@ -174,7 +174,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel } } - private Key detectKey(int x, int y, int pointerId) { + private Key detectKey(int x, int y) { final Key oldKey = mCurrentKey; final Key newKey = mKeyDetector.detectHitKey(x, y); if (newKey == oldKey) { diff --git a/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java b/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java index 8010a3e7e..17dfc9cce 100644 --- a/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/emoji/EmojiPageKeyboardView.java @@ -56,22 +56,7 @@ final class EmojiPageKeyboardView extends KeyboardView implements private OnKeyEventListener mListener = EMPTY_LISTENER; private final KeyDetector mKeyDetector = new KeyDetector(); private final GestureDetector mGestureDetector; - private EmojiPageKeyboardAccessibilityDelegate mAccessibilityDelegate; - - private static final class EmojiPageKeyboardAccessibilityDelegate - extends KeyboardAccessibilityDelegate<EmojiPageKeyboardView> { - public EmojiPageKeyboardAccessibilityDelegate(final EmojiPageKeyboardView keyboardView, - final KeyDetector keyDetector) { - super(keyboardView, keyDetector); - } - - @Override - protected void simulateTouchEvent(int touchAction, MotionEvent hoverEvent) { - final MotionEvent touchEvent = synthesizeTouchEvent(touchAction, hoverEvent); - mKeyboardView.onTouchEvent(touchEvent); - touchEvent.recycle(); - } - } + private KeyboardAccessibilityDelegate<EmojiPageKeyboardView> mAccessibilityDelegate; public EmojiPageKeyboardView(final Context context, final AttributeSet attrs) { this(context, attrs, R.attr.keyboardViewStyle); @@ -98,8 +83,7 @@ final class EmojiPageKeyboardView extends KeyboardView implements mKeyDetector.setKeyboard(keyboard, 0 /* correctionX */, 0 /* correctionY */); if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) { if (mAccessibilityDelegate == null) { - mAccessibilityDelegate = new EmojiPageKeyboardAccessibilityDelegate( - this, mKeyDetector); + mAccessibilityDelegate = new KeyboardAccessibilityDelegate<>(this, mKeyDetector); } mAccessibilityDelegate.setKeyboard(keyboard); } else { diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java index ab2555802..13b174e94 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsTable.java @@ -89,9 +89,9 @@ public final class KeyboardTextsTable { /* 3:29 */ "morekeys_e", /* 4:28 */ "morekeys_i", /* 5:23 */ "morekeys_c", - /* 6:23 */ "double_quotes", - /* 7:22 */ "morekeys_n", - /* 8:22 */ "keylabel_to_alpha", + /* 6:23 */ "keylabel_to_alpha", + /* 7:23 */ "double_quotes", + /* 8:22 */ "morekeys_n", /* 9:22 */ "single_quotes", /* 10:20 */ "morekeys_s", /* 11:14 */ "morekeys_y", @@ -260,10 +260,10 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_lqm_rqm", - /* morekeys_n */ EMPTY, // Label for "switch to alphabetic" key. /* keylabel_to_alpha */ "ABC", + /* double_quotes */ "!text/double_lqm_rqm", + /* morekeys_n */ EMPTY, /* single_quotes */ "!text/single_lqm_rqm", /* morekeys_s ~ */ EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, @@ -507,14 +507,14 @@ public final class KeyboardTextsTable { // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON // U+0133: "ij" LATIN SMALL LIGATURE IJ /* morekeys_i */ "\u00ED,\u00EC,\u00EF,\u00EE,\u012F,\u012B,\u0133", - /* morekeys_c */ null, - /* double_quotes */ null, + /* morekeys_c ~ */ + null, null, null, + /* ~ double_quotes */ // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha ~ */ - null, null, null, - /* ~ morekeys_s */ + /* single_quotes */ null, + /* morekeys_s */ null, // U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE // U+0133: "ij" LATIN SMALL LIGATURE IJ /* morekeys_y */ "\u00FD,\u0133", @@ -523,17 +523,17 @@ public final class KeyboardTextsTable { /* Locale ar: Arabic */ private static final String[] TEXTS_ar = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0623: "أ" ARABIC LETTER ALEF WITH HAMZA ABOVE // U+200C: ZERO WIDTH NON-JOINER // U+0628: "ب" ARABIC LETTER BEH // U+062C: "ج" ARABIC LETTER JEEM /* keylabel_to_alpha */ "\u0623\u200C\u0628\u200C\u062C", - /* single_quotes ~ */ + /* double_quotes ~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, /* ~ morekeys_cyrillic_soft_sign */ // U+0661: "١" ARABIC-INDIC DIGIT ONE /* keyspec_symbols_1 */ "\u0661", @@ -685,7 +685,7 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", - /* double_quotes ~ */ + /* keylabel_to_alpha ~ */ null, null, null, null, /* ~ single_quotes */ // U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA @@ -705,13 +705,13 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", + /* double_quotes */ "!text/double_9qm_lqm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_9qm_lqm", /* morekeys_s ~ */ null, null, null, null, null, null, null, null, null, null, null, null, @@ -738,14 +738,13 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - // single_quotes of Bulgarian is default single_quotes_right_left. - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", + // single_quotes of Bulgarian is default single_quotes_right_left. + /* double_quotes */ "!text/double_9qm_lqm", }; /* Locale ca: Catalan */ @@ -796,12 +795,13 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha ~ */ - null, null, null, null, null, null, null, + /* single_quotes ~ */ + null, null, null, null, null, null, /* ~ morekeys_t */ // U+00B7: "·" MIDDLE DOT // U+0142: "ł" LATIN SMALL LETTER L WITH STROKE @@ -870,12 +870,12 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE /* morekeys_c */ "\u010D,\u00E7,\u0107", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", // U+0148: "ň" LATIN SMALL LETTER N WITH CARON // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u0148,\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -930,11 +930,11 @@ public final class KeyboardTextsTable { // U+00EF: "ï" LATIN SMALL LETTER I WITH DIAERESIS /* morekeys_i */ "\u00ED,\u00EF", /* morekeys_c */ null, + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+00DF: "ß" LATIN SMALL LETTER SHARP S // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE @@ -1004,13 +1004,13 @@ public final class KeyboardTextsTable { // U+00EB: "ë" LATIN SMALL LETTER E WITH DIAERESIS // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE /* morekeys_e */ "\u00E9,\u00E8,\u00EA,\u00EB,\u0117", - /* morekeys_i */ null, - /* morekeys_c */ null, + /* morekeys_i ~ */ + null, null, null, + /* ~ keylabel_to_alpha */ /* double_quotes */ "!text/double_9qm_lqm", // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+00DF: "ß" LATIN SMALL LETTER SHARP S // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE @@ -1043,8 +1043,8 @@ public final class KeyboardTextsTable { /* Locale el: Greek */ private static final String[] TEXTS_el = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0391: "Α" GREEK CAPITAL LETTER ALPHA // U+0392: "Β" GREEK CAPITAL LETTER BETA @@ -1092,10 +1092,10 @@ public final class KeyboardTextsTable { /* morekeys_i */ "\u00ED,\u00EE,\u00EF,\u012B,\u00EC", // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA /* morekeys_c */ "\u00E7", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE /* morekeys_n */ "\u00F1", - /* keylabel_to_alpha */ null, /* single_quotes */ null, // U+00DF: "ß" LATIN SMALL LETTER SHARP S /* morekeys_s */ "\u00DF", @@ -1161,6 +1161,7 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+010B: "ċ" LATIN SMALL LETTER C WITH DOT ABOVE /* morekeys_c */ "\u0107,\u010D,\u00E7,\u010B", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE @@ -1169,7 +1170,6 @@ public final class KeyboardTextsTable { // U+0149: "ʼn" LATIN SMALL LETTER N PRECEDED BY APOSTROPHE // U+014B: "ŋ" LATIN SMALL LETTER ENG /* morekeys_n */ "\u00F1,\u0144,\u0146,\u0148,\u0149,\u014B", - /* keylabel_to_alpha */ null, /* single_quotes */ null, // U+00DF: "ß" LATIN SMALL LETTER SHARP S // U+0161: "š" LATIN SMALL LETTER S WITH CARON @@ -1297,15 +1297,15 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha ~ */ + /* single_quotes ~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, /* ~ morekeys_nordic_row2_11 */ // U+00A1: "¡" INVERTED EXCLAMATION MARK // U+00BF: "¿" INVERTED QUESTION MARK @@ -1363,12 +1363,12 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE /* morekeys_c */ "\u010D,\u00E7,\u0107", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", // U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u0146,\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -1463,6 +1463,7 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE @@ -1472,16 +1473,16 @@ public final class KeyboardTextsTable { /* Locale fa: Persian */ private static final String[] TEXTS_fa = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0627: "ا" ARABIC LETTER ALEF // U+200C: ZERO WIDTH NON-JOINER // U+0628: "ب" ARABIC LETTER BEH // U+067E: "پ" ARABIC LETTER PEH /* keylabel_to_alpha */ "\u0627\u200C\u0628\u200C\u067E", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+FDFC: "﷼" RIAL SIGN /* keyspec_currency */ "\uFDFC", @@ -1710,7 +1711,7 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,%,\u0107,\u010D", - /* double_quotes ~ */ + /* keylabel_to_alpha ~ */ null, null, null, null, null, /* ~ morekeys_s */ // U+00FF: "ÿ" LATIN SMALL LETTER Y WITH DIAERESIS @@ -1782,6 +1783,7 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE @@ -1791,15 +1793,15 @@ public final class KeyboardTextsTable { /* Locale hi: Hindi */ private static final String[] TEXTS_hi = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0915: "क" DEVANAGARI LETTER KA // U+0916: "ख" DEVANAGARI LETTER KHA // U+0917: "ग" DEVANAGARI LETTER GA /* keylabel_to_alpha */ "\u0915\u0916\u0917", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+20B9: "₹" INDIAN RUPEE SIGN /* keyspec_currency */ "\u20B9", @@ -1849,11 +1851,11 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA /* morekeys_c */ "\u010D,\u0107,\u00E7", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_rqm", // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_rqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE @@ -1917,9 +1919,9 @@ public final class KeyboardTextsTable { // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON /* morekeys_i */ "\u00ED,\u00EE,\u00EF,\u00EC,\u012F,\u012B", /* morekeys_c */ null, + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_rqm", /* morekeys_n */ null, - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_rqm", /* morekeys_s ~ */ null, null, null, null, null, null, null, null, @@ -1931,17 +1933,18 @@ public final class KeyboardTextsTable { /* Locale hy_AM: Armenian (Armenia) */ private static final String[] TEXTS_hy_AM = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0531: "Ա" ARMENIAN CAPITAL LETTER AYB // U+0532: "Բ" ARMENIAN CAPITAL LETTER BEN // U+0533: "Գ" ARMENIAN CAPITAL LETTER GIM /* keylabel_to_alpha */ "\u0531\u0532\u0533", - /* single_quotes ~ */ + /* double_quotes ~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, /* ~ morekeys_nordic_row2_11 */ // U+055E: "՞" ARMENIAN QUESTION MARK // U+055C: "՜" ARMENIAN EXCLAMATION MARK @@ -2027,9 +2030,9 @@ public final class KeyboardTextsTable { // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON /* morekeys_i */ "\u00ED,\u00EF,\u00EE,\u00EC,\u012F,\u012B", /* morekeys_c */ null, + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", /* morekeys_n */ null, - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", /* morekeys_s */ null, // U+00FD: "ý" LATIN SMALL LETTER Y WITH ACUTE @@ -2110,13 +2113,13 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_rqm_9qm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+05D0: "א" HEBREW LETTER ALEF // U+05D1: "ב" HEBREW LETTER BET // U+05D2: "ג" HEBREW LETTER GIMEL /* keylabel_to_alpha */ "\u05D0\u05D1\u05D2", + /* double_quotes */ "!text/double_rqm_9qm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_rqm_9qm", /* morekeys_s ~ */ null, null, null, null, null, null, @@ -2167,28 +2170,28 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+10D0: "ა" GEORGIAN LETTER AN // U+10D1: "ბ" GEORGIAN LETTER BAN // U+10D2: "გ" GEORGIAN LETTER GAN /* keylabel_to_alpha */ "\u10D0\u10D1\u10D2", + /* double_quotes */ "!text/double_9qm_lqm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_9qm_lqm", }; /* Locale kk: Kazakh */ private static final String[] TEXTS_kk = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", - /* single_quotes ~ */ - null, null, null, null, null, null, null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, /* ~ morekeys_k */ // U+0451: "ё" CYRILLIC SMALL LETTER IO /* morekeys_cyrillic_ie */ "\u0451", @@ -2237,14 +2240,14 @@ public final class KeyboardTextsTable { /* Locale km_KH: Khmer (Cambodia) */ private static final String[] TEXTS_km_KH = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+1780: "ក" KHMER LETTER KA // U+1781: "ខ" KHMER LETTER KHA // U+1782: "គ" KHMER LETTER KO /* keylabel_to_alpha */ "\u1780\u1781\u1782", - /* single_quotes ~ */ + /* double_quotes ~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, @@ -2252,7 +2255,7 @@ public final class KeyboardTextsTable { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, /* ~ morekeys_cyrillic_a */ // U+17DB: "៛" KHMER CURRENCY SYMBOL RIEL /* morekeys_currency_dollar */ "\u17DB,\u00A2,\u00A3,\u20AC,\u00A5,\u20B1", @@ -2261,15 +2264,15 @@ public final class KeyboardTextsTable { /* Locale ky: Kirghiz */ private static final String[] TEXTS_ky = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", - /* single_quotes ~ */ - null, null, null, null, null, null, null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, /* ~ morekeys_k */ // U+0451: "ё" CYRILLIC SMALL LETTER IO /* morekeys_cyrillic_ie */ "\u0451", @@ -2304,15 +2307,15 @@ public final class KeyboardTextsTable { /* Locale lo_LA: Lao (Laos) */ private static final String[] TEXTS_lo_LA = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0E81: "ກ" LAO LETTER KO // U+0E82: "ຂ" LAO LETTER KHO SUNG // U+0E84: "ຄ" LAO LETTER KHO TAM /* keylabel_to_alpha */ "\u0E81\u0E82\u0E84", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+20AD: "₭" KIP SIGN /* keyspec_currency */ "\u20AD", @@ -2370,12 +2373,12 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE /* morekeys_c */ "\u010D,\u00E7,\u0107", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", // U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u0146,\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -2464,12 +2467,12 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE /* morekeys_c */ "\u010D,\u00E7,\u0107", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", // U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u0146,\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -2512,13 +2515,13 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", + /* double_quotes */ "!text/double_9qm_lqm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_9qm_lqm", /* morekeys_s ~ */ null, null, null, null, null, null, null, null, null, null, null, null, @@ -2547,15 +2550,15 @@ public final class KeyboardTextsTable { /* Locale mn_MN: Mongolian (Mongolia) */ private static final String[] TEXTS_mn_MN = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+20AE: "₮" TUGRIK SIGN /* keyspec_currency */ "\u20AE", @@ -2564,15 +2567,15 @@ public final class KeyboardTextsTable { /* Locale mr_IN: Marathi (India) */ private static final String[] TEXTS_mr_IN = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0915: "क" DEVANAGARI LETTER KA // U+0916: "ख" DEVANAGARI LETTER KHA // U+0917: "ग" DEVANAGARI LETTER GA /* keylabel_to_alpha */ "\u0915\u0916\u0917", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+20B9: "₹" INDIAN RUPEE SIGN /* keyspec_currency */ "\u20B9", @@ -2616,17 +2619,18 @@ public final class KeyboardTextsTable { /* Locale my_MM: Burmese (Myanmar) */ private static final String[] TEXTS_my_MM = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+1000: "က" MYANMAR LETTER KA // U+1001: "ခ" MYANMAR LETTER KHA // U+1002: "ဂ" MYANMAR LETTER GA /* keylabel_to_alpha */ "\u1000\u1001\u1002", - /* single_quotes ~ */ + /* double_quotes ~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, /* ~ morekeys_nordic_row2_11 */ /* morekeys_punctuation */ "!autoColumnOrder!9,\u104A,.,?,!,#,),(,/,;,...,',@,:,-,\",+,\\%,&", // U+104A: "၊" MYANMAR SIGN LITTLE SECTION @@ -2681,11 +2685,11 @@ public final class KeyboardTextsTable { // U+0117: "ė" LATIN SMALL LETTER E WITH DOT ABOVE // U+0113: "ē" LATIN SMALL LETTER E WITH MACRON /* morekeys_e */ "\u00E9,\u00E8,\u00EA,\u00EB,\u0119,\u0117,\u0113", - /* morekeys_i */ null, - /* morekeys_c */ null, + /* morekeys_i ~ */ + null, null, null, + /* ~ keylabel_to_alpha */ /* double_quotes */ "!text/double_9qm_rqm", /* morekeys_n */ null, - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_rqm", /* morekeys_s ~ */ null, null, null, null, null, null, null, null, null, null, null, null, null, @@ -2709,15 +2713,15 @@ public final class KeyboardTextsTable { /* Locale ne_NP: Nepali (Nepal) */ private static final String[] TEXTS_ne_NP = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0915: "क" DEVANAGARI LETTER KA // U+0916: "ख" DEVANAGARI LETTER KHA // U+0917: "ग" DEVANAGARI LETTER GA /* keylabel_to_alpha */ "\u0915\u0916\u0917", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+0930/U+0941/U+002E "रु." NEPALESE RUPEE SIGN /* keyspec_currency */ "\u0930\u0941.", @@ -2801,11 +2805,11 @@ public final class KeyboardTextsTable { // U+0133: "ij" LATIN SMALL LIGATURE IJ /* morekeys_i */ "\u00ED,\u00EF,\u00EC,\u00EE,\u012F,\u012B,\u0133", /* morekeys_c */ null, + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_rqm", // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_rqm", /* morekeys_s */ null, // U+0133: "ij" LATIN SMALL LIGATURE IJ @@ -2847,11 +2851,11 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u0107,\u00E7,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_rqm", // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE /* morekeys_n */ "\u0144,\u00F1", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_rqm", // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -2952,9 +2956,9 @@ public final class KeyboardTextsTable { // U+012B: "ī" LATIN SMALL LETTER I WITH MACRON /* morekeys_i */ "\u00EE,\u00EF,\u00EC,\u00ED,\u012F,\u012B", /* morekeys_c */ null, + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_rqm", /* morekeys_n */ null, - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_rqm", // U+0219: "ș" LATIN SMALL LETTER S WITH COMMA BELOW // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -2973,13 +2977,13 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", + /* double_quotes */ "!text/double_9qm_lqm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_9qm_lqm", /* morekeys_s ~ */ null, null, null, null, null, null, null, null, null, null, null, null, @@ -3001,6 +3005,17 @@ public final class KeyboardTextsTable { /* morekeys_cyrillic_soft_sign */ "\u044A", }; + /* Locale si_LK: Sinhalese (Sri Lanka) */ + private static final String[] TEXTS_si_LK = { + /* morekeys_a ~ */ + null, null, null, null, null, null, + /* ~ morekeys_c */ + // Label for "switch to alphabetic" key. + // U+0D85: "අ" SINHALA LETTER AYANNA + // U+0D86: "ආ" SINHALA LETTER AAYANNA + /* keylabel_to_alpha */ "\u0D85,\u0D86", + }; + /* Locale sk: Slovak */ private static final String[] TEXTS_sk = { // U+00E1: "á" LATIN SMALL LETTER A WITH ACUTE @@ -3052,13 +3067,13 @@ public final class KeyboardTextsTable { // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE /* morekeys_c */ "\u010D,\u00E7,\u0107", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", // U+0148: "ň" LATIN SMALL LETTER N WITH CARON // U+0146: "ņ" LATIN SMALL LETTER N WITH CEDILLA // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE /* morekeys_n */ "\u0148,\u0146,\u00F1,\u0144", - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON // U+00DF: "ß" LATIN SMALL LETTER SHARP S @@ -3104,9 +3119,9 @@ public final class KeyboardTextsTable { // U+010D: "č" LATIN SMALL LETTER C WITH CARON // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE /* morekeys_c */ "\u010D,\u0107", + /* keylabel_to_alpha */ null, /* double_quotes */ "!text/double_9qm_lqm", /* morekeys_n */ null, - /* keylabel_to_alpha */ null, /* single_quotes */ "!text/single_9qm_lqm", // U+0161: "š" LATIN SMALL LETTER S WITH CARON /* morekeys_s */ "\u0161", @@ -3127,14 +3142,14 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // END: More keys definitions for Serbian (Cyrillic) // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", + /* double_quotes */ "!text/double_9qm_lqm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_9qm_lqm", /* morekeys_s ~ */ null, null, null, null, null, null, null, null, @@ -3217,12 +3232,12 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0148: "ň" LATIN SMALL LETTER N WITH CARON /* morekeys_n */ "\u0144,\u00F1,\u0148", - /* keylabel_to_alpha */ null, /* single_quotes */ null, // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE // U+0161: "š" LATIN SMALL LETTER S WITH CARON @@ -3310,10 +3325,10 @@ public final class KeyboardTextsTable { /* morekeys_i */ "\u00EE,\u00EF,\u00ED,\u012B,\u00EC", // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA /* morekeys_c */ "\u00E7", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE /* morekeys_n */ "\u00F1", - /* keylabel_to_alpha */ null, /* single_quotes */ null, // U+00DF: "ß" LATIN SMALL LETTER SHARP S /* morekeys_s */ "\u00DF", @@ -3326,15 +3341,15 @@ public final class KeyboardTextsTable { /* Locale th: Thai */ private static final String[] TEXTS_th = { /* morekeys_a ~ */ - null, null, null, null, null, null, null, null, - /* ~ morekeys_n */ + null, null, null, null, null, null, + /* ~ morekeys_c */ // Label for "switch to alphabetic" key. // U+0E01: "ก" THAI CHARACTER KO KAI // U+0E02: "ข" THAI CHARACTER KHO KHAI // U+0E04: "ค" THAI CHARACTER KHO KHWAI /* keylabel_to_alpha */ "\u0E01\u0E02\u0E04", - /* single_quotes ~ */ - null, null, null, null, null, null, null, + /* double_quotes ~ */ + null, null, null, null, null, null, null, null, null, /* ~ morekeys_l */ // U+0E3F: "฿" THAI CURRENCY SYMBOL BAHT /* keyspec_currency */ "\u0E3F", @@ -3388,6 +3403,7 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE @@ -3426,7 +3442,7 @@ public final class KeyboardTextsTable { // U+0107: "ć" LATIN SMALL LETTER C WITH ACUTE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u010D", - /* double_quotes ~ */ + /* keylabel_to_alpha ~ */ null, null, null, null, /* ~ single_quotes */ // U+015F: "ş" LATIN SMALL LETTER S WITH CEDILLA @@ -3446,13 +3462,13 @@ public final class KeyboardTextsTable { /* morekeys_a ~ */ null, null, null, null, null, null, /* ~ morekeys_c */ - /* double_quotes */ "!text/double_9qm_lqm", - /* morekeys_n */ null, // Label for "switch to alphabetic" key. // U+0410: "А" CYRILLIC CAPITAL LETTER A // U+0411: "Б" CYRILLIC CAPITAL LETTER BE // U+0412: "В" CYRILLIC CAPITAL LETTER VE /* keylabel_to_alpha */ "\u0410\u0411\u0412", + /* double_quotes */ "!text/double_9qm_lqm", + /* morekeys_n */ null, /* single_quotes */ "!text/single_9qm_lqm", /* morekeys_s ~ */ null, null, null, null, null, null, @@ -3613,10 +3629,10 @@ public final class KeyboardTextsTable { /* morekeys_i */ "\u00ED,\u00EE,\u00EF,\u012B,\u00EC", // U+00E7: "ç" LATIN SMALL LETTER C WITH CEDILLA /* morekeys_c */ "\u00E7", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE /* morekeys_n */ "\u00F1", - /* keylabel_to_alpha */ null, /* single_quotes */ null, // U+00DF: "ß" LATIN SMALL LETTER SHARP S /* morekeys_s */ "\u00DF", @@ -3686,6 +3702,7 @@ public final class KeyboardTextsTable { // U+010B: "ċ" LATIN SMALL LETTER C WITH DOT ABOVE // U+010D: "č" LATIN SMALL LETTER C WITH CARON /* morekeys_c */ "\u00E7,\u0107,\u0109,\u010B,\u010D", + /* keylabel_to_alpha */ null, /* double_quotes */ null, // U+00F1: "ñ" LATIN SMALL LETTER N WITH TILDE // U+0144: "ń" LATIN SMALL LETTER N WITH ACUTE @@ -3694,7 +3711,6 @@ public final class KeyboardTextsTable { // U+0149: "ʼn" LATIN SMALL LETTER N PRECEDED BY APOSTROPHE // U+014B: "ŋ" LATIN SMALL LETTER ENG /* morekeys_n */ "\u00F1,\u0144,\u0146,\u0148,\u0149,\u014B", - /* keylabel_to_alpha */ null, /* single_quotes */ null, // U+00DF: "ß" LATIN SMALL LETTER SHARP S // U+015B: "ś" LATIN SMALL LETTER S WITH ACUTE @@ -3767,21 +3783,21 @@ public final class KeyboardTextsTable { "ar" , TEXTS_ar, /* 55/110 Arabic */ "az_AZ" , TEXTS_az_AZ, /* 8/ 18 Azerbaijani (Azerbaijan) */ "be_BY" , TEXTS_be_BY, /* 9/ 32 Belarusian (Belarus) */ - "bg" , TEXTS_bg, /* 2/ 9 Bulgarian */ + "bg" , TEXTS_bg, /* 2/ 8 Bulgarian */ "ca" , TEXTS_ca, /* 11/ 95 Catalan */ "cs" , TEXTS_cs, /* 17/ 21 Czech */ "da" , TEXTS_da, /* 19/ 54 Danish */ "de" , TEXTS_de, /* 16/ 62 German */ - "el" , TEXTS_el, /* 1/ 9 Greek */ + "el" , TEXTS_el, /* 1/ 7 Greek */ "en" , TEXTS_en, /* 8/ 11 English */ "eo" , TEXTS_eo, /* 26/118 Esperanto */ "es" , TEXTS_es, /* 8/ 55 Spanish */ "et_EE" , TEXTS_et_EE, /* 22/ 27 Estonian (Estonia) */ - "eu_ES" , TEXTS_eu_ES, /* 7/ 8 Basque (Spain) */ + "eu_ES" , TEXTS_eu_ES, /* 7/ 9 Basque (Spain) */ "fa" , TEXTS_fa, /* 58/125 Persian */ "fi" , TEXTS_fi, /* 10/ 54 Finnish */ "fr" , TEXTS_fr, /* 13/ 62 French */ - "gl_ES" , TEXTS_gl_ES, /* 7/ 8 Gallegan (Spain) */ + "gl_ES" , TEXTS_gl_ES, /* 7/ 9 Gallegan (Spain) */ "hi" , TEXTS_hi, /* 23/ 53 Hindi */ "hr" , TEXTS_hr, /* 9/ 20 Croatian */ "hu" , TEXTS_hu, /* 9/ 20 Hungarian */ @@ -3808,13 +3824,14 @@ public final class KeyboardTextsTable { "rm" , TEXTS_rm, /* 1/ 2 Raeto-Romance */ "ro" , TEXTS_ro, /* 6/ 15 Romanian */ "ru" , TEXTS_ru, /* 9/ 32 Russian */ + "si_LK" , TEXTS_si_LK, /* 1/ 7 Sinhalese (Sri Lanka) */ "sk" , TEXTS_sk, /* 20/ 22 Slovak */ "sl" , TEXTS_sl, /* 8/ 20 Slovenian */ "sr" , TEXTS_sr, /* 11/ 93 Serbian */ "sv" , TEXTS_sv, /* 21/ 54 Swedish */ "sw" , TEXTS_sw, /* 9/ 18 Swahili */ "th" , TEXTS_th, /* 2/ 17 Thai */ - "tl" , TEXTS_tl, /* 7/ 8 Tagalog */ + "tl" , TEXTS_tl, /* 7/ 9 Tagalog */ "tr" , TEXTS_tr, /* 7/ 18 Turkish */ "uk" , TEXTS_uk, /* 11/ 87 Ukrainian */ "vi" , TEXTS_vi, /* 8/ 17 Vietnamese */ diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java index b4e115c7d..43af66eb7 100644 --- a/java/src/com/android/inputmethod/latin/Constants.java +++ b/java/src/com/android/inputmethod/latin/Constants.java @@ -220,6 +220,7 @@ public final class Constants { public static final String REGEXP_PERIOD = "\\."; public static final String STRING_SPACE = " "; + public static final String STRING_PERIOD_AND_SPACE = ". "; /** * Special keys code. Must be negative. diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index a8f9efb05..6e5e0deaa 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1001,6 +1001,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (!mSettings.getCurrent().isApplicationSpecifiedCompletionsOn()) { return; } + // If we have an update request in flight, we need to cancel it so it does not override + // these completions. + mHandler.cancelUpdateSuggestionStrip(); if (applicationSpecifiedCompletions == null) { setNeutralSuggestionStrip(); return; diff --git a/java/src/com/android/inputmethod/latin/PrevWordsInfo.java b/java/src/com/android/inputmethod/latin/PrevWordsInfo.java index 5dda44445..f45c73f53 100644 --- a/java/src/com/android/inputmethod/latin/PrevWordsInfo.java +++ b/java/src/com/android/inputmethod/latin/PrevWordsInfo.java @@ -27,7 +27,8 @@ import com.android.inputmethod.latin.utils.StringUtils; public class PrevWordsInfo { public static final PrevWordsInfo EMPTY_PREV_WORDS_INFO = new PrevWordsInfo(WordInfo.EMPTY_WORD_INFO); - public static final PrevWordsInfo BEGINNING_OF_SENTENCE = new PrevWordsInfo(); + public static final PrevWordsInfo BEGINNING_OF_SENTENCE = + new PrevWordsInfo(WordInfo.BEGINNING_OF_SENTENCE); /** * Word information used to represent previous words information. @@ -57,6 +58,24 @@ public class PrevWordsInfo { public boolean isValid() { return mWord != null; } + + @Override + public int hashCode() { + return Arrays.hashCode(new Object[] { mWord, mIsBeginningOfSentence } ); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof WordInfo)) return false; + final WordInfo wordInfo = (WordInfo)o; + if (mWord == null || wordInfo.mWord == null) { + return mWord == wordInfo.mWord + && mIsBeginningOfSentence == wordInfo.mIsBeginningOfSentence; + } + return mWord.equals(wordInfo.mWord) + && mIsBeginningOfSentence == wordInfo.mIsBeginningOfSentence; + } } // The words immediately before the considered word. EMPTY_WORD_INFO element means we don't @@ -67,16 +86,9 @@ public class PrevWordsInfo { // calling getSuggetions* in this situation. public WordInfo[] mPrevWordsInfo = new WordInfo[Constants.MAX_PREV_WORD_COUNT_FOR_N_GRAM]; - // Beginning of sentence. - public PrevWordsInfo() { - mPrevWordsInfo[0] = WordInfo.BEGINNING_OF_SENTENCE; - Arrays.fill(mPrevWordsInfo, 1 /* start */, mPrevWordsInfo.length, WordInfo.EMPTY_WORD_INFO); - } - // Construct from the previous word information. public PrevWordsInfo(final WordInfo prevWordInfo) { mPrevWordsInfo[0] = prevWordInfo; - Arrays.fill(mPrevWordsInfo, 1 /* start */, mPrevWordsInfo.length, WordInfo.EMPTY_WORD_INFO); } // Construct from WordInfo array. n-th element represents (n+1)-th previous word's information. @@ -116,6 +128,19 @@ public class PrevWordsInfo { } @Override + public int hashCode() { + return Arrays.hashCode(mPrevWordsInfo); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof PrevWordsInfo)) return false; + final PrevWordsInfo prevWordsInfo = (PrevWordsInfo)o; + return Arrays.equals(mPrevWordsInfo, prevWordsInfo.mPrevWordsInfo); + } + + @Override public String toString() { final StringBuffer builder = new StringBuffer(); for (int i = 0; i < mPrevWordsInfo.length; i++) { @@ -123,7 +148,7 @@ public class PrevWordsInfo { builder.append("PrevWord["); builder.append(i); builder.append("]: "); - if (!wordInfo.isValid()) { + if (wordInfo == null || !wordInfo.isValid()) { builder.append("Empty. "); continue; } diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 3be6bccc6..62b55bca1 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -26,6 +26,7 @@ import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputConnection; +import com.android.inputmethod.latin.PrevWordsInfo.WordInfo; import com.android.inputmethod.latin.settings.SpacingAndPunctuations; import com.android.inputmethod.latin.utils.CapsModeUtils; import com.android.inputmethod.latin.utils.DebugLogUtils; @@ -49,8 +50,10 @@ public final class RichInputConnection { private static final boolean DBG = false; private static final boolean DEBUG_PREVIOUS_TEXT = false; private static final boolean DEBUG_BATCH_NESTING = false; - // Provision for a long word pair and a separator - private static final int LOOKBACK_CHARACTER_NUM = Constants.DICTIONARY_MAX_WORD_LENGTH * 2 + 1; + // Provision for long words and separators between the words. + private static final int LOOKBACK_CHARACTER_NUM = Constants.DICTIONARY_MAX_WORD_LENGTH + * (Constants.MAX_PREV_WORD_COUNT_FOR_N_GRAM + 1) /* words */ + + Constants.MAX_PREV_WORD_COUNT_FOR_N_GRAM /* separators */; private static final Pattern spaceRegex = Pattern.compile("\\s+"); private static final int INVALID_CURSOR_POSITION = -1; @@ -544,22 +547,25 @@ public final class RichInputConnection { return Arrays.binarySearch(sortedSeparators, code) >= 0; } - // Get information of the nth word before cursor. n = 1 retrieves the word immediately before - // the cursor, n = 2 retrieves the word before that, and so on. This splits on whitespace only. + // Get context information from nth word before the cursor. n = 1 retrieves the words + // immediately before the cursor, n = 2 retrieves the words before that, and so on. This splits + // on whitespace only. // Also, it won't return words that end in a separator (if the nth word before the cursor // ends in a separator, it returns information representing beginning-of-sentence). - // Example : - // (n = 1) "abc def|" -> def - // (n = 1) "abc def |" -> def - // (n = 1) "abc 'def|" -> 'def + // Example (when Constants.MAX_PREV_WORD_COUNT_FOR_N_GRAM is 2): + // (n = 1) "abc def|" -> abc, def + // (n = 1) "abc def |" -> abc, def + // (n = 1) "abc 'def|" -> empty, 'def // (n = 1) "abc def. |" -> beginning-of-sentence // (n = 1) "abc def . |" -> beginning-of-sentence - // (n = 2) "abc def|" -> abc - // (n = 2) "abc def |" -> abc + // (n = 2) "abc def|" -> beginning-of-sentence, abc + // (n = 2) "abc def |" -> beginning-of-sentence, abc // (n = 2) "abc 'def|" -> empty. The context is different from "abc def", but we cannot // represent this situation using PrevWordsInfo. See TODO in the method. - // (n = 2) "abc def. |" -> abc - // (n = 2) "abc def . |" -> def + // TODO: The next example's result should be "abc, def". This have to be fixed before we + // retrieve the prior context of Beginning-of-Sentence. + // (n = 2) "abc def. |" -> beginning-of-sentence, abc + // (n = 2) "abc def . |" -> abc, def // (n = 2) "abc|" -> beginning-of-sentence // (n = 2) "abc |" -> beginning-of-sentence // (n = 2) "abc. def|" -> beginning-of-sentence @@ -567,43 +573,50 @@ public final class RichInputConnection { final SpacingAndPunctuations spacingAndPunctuations, final int n) { if (prev == null) return PrevWordsInfo.EMPTY_PREV_WORDS_INFO; final String[] w = spaceRegex.split(prev); - - // Referring to the word after the nth word. - if ((n - 1) > 0 && (n - 1) <= w.length) { - final String wordFollowingTheNthPrevWord = w[w.length - n + 1]; - if (!wordFollowingTheNthPrevWord.isEmpty()) { - final char firstChar = wordFollowingTheNthPrevWord.charAt(0); - if (spacingAndPunctuations.isWordConnector(firstChar)) { - // The word following the n-th prev word is starting with a word connector. - // TODO: Return meaningful context for this case. - return PrevWordsInfo.EMPTY_PREV_WORDS_INFO; + final WordInfo[] prevWordsInfo = new WordInfo[Constants.MAX_PREV_WORD_COUNT_FOR_N_GRAM]; + for (int i = 0; i < prevWordsInfo.length; i++) { + final int focusedWordIndex = w.length - n - i; + // Referring to the word after the focused word. + if ((focusedWordIndex + 1) >= 0 && (focusedWordIndex + 1) < w.length) { + final String wordFollowingTheNthPrevWord = w[focusedWordIndex + 1]; + if (!wordFollowingTheNthPrevWord.isEmpty()) { + final char firstChar = wordFollowingTheNthPrevWord.charAt(0); + if (spacingAndPunctuations.isWordConnector(firstChar)) { + // The word following the focused word is starting with a word connector. + // TODO: Return meaningful context for this case. + prevWordsInfo[i] = WordInfo.EMPTY_WORD_INFO; + break; + } } } + // If we can't find (n + i) words, the context is beginning-of-sentence. + if (focusedWordIndex < 0) { + prevWordsInfo[i] = WordInfo.BEGINNING_OF_SENTENCE; + break; + } + final String focusedWord = w[focusedWordIndex]; + // If the word is empty, the context is beginning-of-sentence. + final int length = focusedWord.length(); + if (length <= 0) { + prevWordsInfo[i] = WordInfo.BEGINNING_OF_SENTENCE; + break; + } + // If ends in a sentence separator, the context is beginning-of-sentence. + final char lastChar = focusedWord.charAt(length - 1); + if (spacingAndPunctuations.isSentenceSeparator(lastChar)) { + prevWordsInfo[i] = WordInfo.BEGINNING_OF_SENTENCE; + break; + } + // If ends in a word separator or connector, the context is unclear. + // TODO: Return meaningful context for this case. + if (spacingAndPunctuations.isWordSeparator(lastChar) + || spacingAndPunctuations.isWordConnector(lastChar)) { + prevWordsInfo[i] = WordInfo.EMPTY_WORD_INFO; + break; + } + prevWordsInfo[i] = new WordInfo(focusedWord); } - - // If we can't find n words, or we found an empty word, the context is - // beginning-of-sentence. - if (w.length < n) { - return PrevWordsInfo.BEGINNING_OF_SENTENCE; - } - final String nthPrevWord = w[w.length - n]; - final int length = nthPrevWord.length(); - if (length <= 0) { - return PrevWordsInfo.BEGINNING_OF_SENTENCE; - } - - // If ends in a sentence separator, the context is beginning-of-sentence. - final char lastChar = nthPrevWord.charAt(length - 1); - if (spacingAndPunctuations.isSentenceSeparator(lastChar)) { - return PrevWordsInfo.BEGINNING_OF_SENTENCE; - } - // If ends in a word separator or connector, the context is unclear. - // TODO: Return meaningful context for this case. - if (spacingAndPunctuations.isWordSeparator(lastChar) - || spacingAndPunctuations.isWordConnector(lastChar)) { - return PrevWordsInfo.EMPTY_PREV_WORDS_INFO; - } - return new PrevWordsInfo(new PrevWordsInfo.WordInfo(nthPrevWord)); + return new PrevWordsInfo(prevWordsInfo); } /** @@ -741,13 +754,12 @@ public final class RichInputConnection { // Here we test whether we indeed have a period and a space before us. This should not // be needed, but it's there just in case something went wrong. final CharSequence textBeforeCursor = getTextBeforeCursor(2, 0); - final String periodSpace = ". "; - if (!TextUtils.equals(periodSpace, textBeforeCursor)) { + if (!TextUtils.equals(Constants.STRING_PERIOD_AND_SPACE, textBeforeCursor)) { // Theoretically we should not be coming here if there isn't ". " before the // cursor, but the application may be changing the text while we are typing, so // anything goes. We should not crash. Log.d(TAG, "Tried to revert double-space combo but we didn't find " - + "\"" + periodSpace + "\" just before the cursor."); + + "\"" + Constants.STRING_PERIOD_AND_SPACE + "\" just before the cursor."); return false; } // Double-space results in ". ". A backspace to cancel this should result in a single diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 692c03a4c..e43db352d 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -126,16 +126,17 @@ public final class Suggest { final boolean didRemoveTypedWord = SuggestedWordInfo.removeDups(typedWord, suggestionsContainer); + final SuggestedWordInfo firstSuggestedWordInfo; final String whitelistedWord; if (suggestionsContainer.isEmpty()) { + firstSuggestedWordInfo = null; whitelistedWord = null; } else { - final SuggestedWordInfo firstSuggestedWordInfo = suggestionsContainer.get(0); - final String firstSuggestion = firstSuggestedWordInfo.mWord; + firstSuggestedWordInfo = suggestionsContainer.get(0); if (!firstSuggestedWordInfo.isKindOf(SuggestedWordInfo.KIND_WHITELIST)) { whitelistedWord = null; } else { - whitelistedWord = firstSuggestion; + whitelistedWord = firstSuggestedWordInfo.mWord; } } @@ -151,10 +152,10 @@ public final class Suggest { // the current settings. It may also be useful to know, when the setting is off, whether // the word *would* have been auto-corrected. if (!isCorrectionEnabled || !allowsToBeAutoCorrected || isPrediction - || suggestionResults.isEmpty() || wordComposer.hasDigits() + || null == firstSuggestedWordInfo || wordComposer.hasDigits() || wordComposer.isMostlyCaps() || wordComposer.isResumed() || !mDictionaryFacilitator.hasInitializedMainDictionary() - || suggestionResults.first().isKindOf(SuggestedWordInfo.KIND_SHORTCUT)) { + || firstSuggestedWordInfo.isKindOf(SuggestedWordInfo.KIND_SHORTCUT)) { // If we don't have a main dictionary, we never want to auto-correct. The reason for // this is, the user may have a contact whose name happens to match a valid word in // their language, and it will unexpectedly auto-correct. For example, if the user @@ -166,7 +167,7 @@ public final class Suggest { hasAutoCorrection = false; } else { hasAutoCorrection = AutoCorrectionUtils.suggestionExceedsAutoCorrectionThreshold( - suggestionResults.first(), consideredWord, mAutoCorrectionThreshold); + firstSuggestedWordInfo, consideredWord, mAutoCorrectionThreshold); } if (!TextUtils.isEmpty(typedWord)) { diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index ec57cd71f..15ddcf9ae 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -1882,10 +1882,11 @@ public final class InputLogic { final CharSequence chosenWordWithSuggestions = SuggestionSpanUtils.getTextWithSuggestionSpan(mLatinIME, chosenWord, suggestedWords); - // Use the 2nd previous word as the previous word because the 1st previous word is the word - // to be committed. + // When we are composing word, get previous words information from the 2nd previous word + // because the 1st previous word is the word to be committed. Otherwise get previous words + // information from the 1st previous word. final PrevWordsInfo prevWordsInfo = mConnection.getPrevWordsInfoFromNthPreviousWord( - settingsValues.mSpacingAndPunctuations, 2); + settingsValues.mSpacingAndPunctuations, mWordComposer.isComposingWord() ? 2 : 1); mConnection.commitText(chosenWordWithSuggestions, 1); // Add the word to the user history dictionary performAdditionToUserHistoryDictionary(settingsValues, chosenWord, prevWordsInfo); diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java index db15c1cc6..be33f339d 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java @@ -258,7 +258,9 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session { return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO | SuggestionsInfo.RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS, new String[] { - TextUtils.join(Constants.STRING_SPACE, splitText) }); + TextUtils.join(Constants.STRING_SPACE, splitText), + TextUtils.join(Constants.STRING_PERIOD_AND_SPACE, + splitText) }); } } return dictInfo.mDictionary.isValidWord(inText) diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java index 528d500d2..47921ca0a 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java @@ -20,8 +20,6 @@ import android.content.Context; import android.util.AttributeSet; import android.util.Log; -import com.android.inputmethod.accessibility.AccessibilityUtils; -import com.android.inputmethod.accessibility.MoreSuggestionsAccessibilityDelegate; import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.KeyboardActionListener; @@ -51,6 +49,7 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView { super(context, attrs, defStyle); } + // TODO: Remove redundant override method. @Override public void setKeyboard(final Keyboard keyboard) { super.setKeyboard(keyboard); @@ -58,16 +57,10 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView { // above {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call. // With accessibility mode on, {@link #mAccessibilityDelegate} is set to a // {@link MoreKeysKeyboardAccessibilityDelegate} object at the above - // {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call. And the object has to be - // overwritten by a {@link MoreSuggestionsAccessibilityDelegate} object here. - if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) { - if (!(mAccessibilityDelegate instanceof MoreSuggestionsAccessibilityDelegate)) { - mAccessibilityDelegate = new MoreSuggestionsAccessibilityDelegate( - this, mKeyDetector); - mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_suggestions); - mAccessibilityDelegate.setCloseAnnounce(R.string.spoken_close_more_suggestions); - } - mAccessibilityDelegate.setKeyboard(keyboard); + // {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call. + if (mAccessibilityDelegate != null) { + mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_suggestions); + mAccessibilityDelegate.setCloseAnnounce(R.string.spoken_close_more_suggestions); } } diff --git a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java index 4dfb38d80..00355c307 100644 --- a/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/ScriptUtils.java @@ -23,9 +23,12 @@ import java.util.TreeMap; * A class to help with handling different writing scripts. */ public class ScriptUtils { + // TODO: should we use ISO 15924 identifiers instead? public static final int SCRIPT_LATIN = 0; public static final int SCRIPT_CYRILLIC = 1; public static final int SCRIPT_GREEK = 2; + public static final int SCRIPT_ARABIC = 3; + public static final int SCRIPT_HEBREW = 4; public static final TreeMap<String, Integer> mLanguageToScript; static { // List of the supported languages and their associated script. We won't check |