Loading java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +1 −1 Original line number Diff line number Diff line Loading @@ -965,8 +965,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; boolean result = onLongPress(popupKey); if (result) { tracker.setAlreadyProcessed(); dismissKeyPreview(); tracker.setAlreadyProcessed(); } return result; } Loading java/src/com/android/inputmethod/latin/LatinKeyboardView.java +39 −16 Original line number Diff line number Diff line Loading @@ -52,6 +52,9 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { /** The y coordinate of the last row */ private int mLastRowY; // This is local working variable for onLongPress(). private int[] mKeyCodes = new int[1]; public LatinKeyboardView(Context context, AttributeSet attrs) { super(context, attrs); } Loading @@ -75,17 +78,37 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { setKeyboardLocal(k); } private static boolean hasOneDigitAlternate(Key key) { final CharSequence alternates = key.popupCharacters; if (alternates == null) return false; final String altChars = alternates.toString(); if (altChars.codePointCount(0, altChars.length()) != 1) return false; final int altCode = altChars.codePointAt(0); return altCode >= '0' && altCode <= '9'; } @Override protected boolean onLongPress(Key key) { if (key.codes[0] == KEYCODE_OPTIONS) { int primaryCode = key.codes[0]; if (primaryCode == KEYCODE_OPTIONS) { getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS_LONGPRESS, null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); return true; } else if (key.codes[0] == '0' && getKeyboard() == mPhoneKeyboard) { } else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) { // Long pressing on 0 in phone number keypad gives you a '+'. getOnKeyboardActionListener().onKey( '+', null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, '+', null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); return true; } else if (hasOneDigitAlternate(key)) { mKeyCodes[0] = primaryCode = key.popupCharacters.charAt(0); // when there is only one alternate character, send it as key action. getOnKeyboardActionListener().onKey(primaryCode, mKeyCodes, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); return true; } else { Loading Loading @@ -262,7 +285,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { return; } char c = mStringToPlay.charAt(mStringIndex); while (c > 255 || mAsciiKeys[(int) c] == null) { while (c > 255 || mAsciiKeys[c] == null) { mStringIndex++; if (mStringIndex >= mStringToPlay.length()) { mPlaying = false; Loading java/src/com/android/inputmethod/latin/PointerTracker.java +7 −1 Original line number Diff line number Diff line Loading @@ -124,6 +124,8 @@ public class PointerTracker { } public void updateKey(int keyIndex) { if (mKeyAlreadyProcessed) return; int oldKeyIndex = mPreviousKey; mPreviousKey = keyIndex; if (keyIndex != oldKeyIndex) { Loading Loading @@ -172,6 +174,8 @@ public class PointerTracker { } public void onMoveEvent(int x, int y, long eventTime) { if (mKeyAlreadyProcessed) return; int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); if (isValidKeyIndex(keyIndex)) { if (mCurrentKey == NOT_A_KEY) { Loading Loading @@ -215,6 +219,8 @@ public class PointerTracker { } public void onUpEvent(int x, int y, long eventTime) { if (mKeyAlreadyProcessed) return; if (DEBUG) debugLog("onUpEvent :", x, y); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); Loading @@ -235,7 +241,7 @@ public class PointerTracker { } showKeyPreviewAndUpdateKey(NOT_A_KEY); // If we're not on a repeating key (which sends on a DOWN event) if (!wasInKeyRepeat && !mKeyAlreadyProcessed) { if (!wasInKeyRepeat) { detectAndSendKey(mCurrentKey, (int)x, (int)y, eventTime); } if (isValidKeyIndex(keyIndex)) Loading Loading
java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +1 −1 Original line number Diff line number Diff line Loading @@ -965,8 +965,8 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return false; boolean result = onLongPress(popupKey); if (result) { tracker.setAlreadyProcessed(); dismissKeyPreview(); tracker.setAlreadyProcessed(); } return result; } Loading
java/src/com/android/inputmethod/latin/LatinKeyboardView.java +39 −16 Original line number Diff line number Diff line Loading @@ -52,6 +52,9 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { /** The y coordinate of the last row */ private int mLastRowY; // This is local working variable for onLongPress(). private int[] mKeyCodes = new int[1]; public LatinKeyboardView(Context context, AttributeSet attrs) { super(context, attrs); } Loading @@ -75,17 +78,37 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { setKeyboardLocal(k); } private static boolean hasOneDigitAlternate(Key key) { final CharSequence alternates = key.popupCharacters; if (alternates == null) return false; final String altChars = alternates.toString(); if (altChars.codePointCount(0, altChars.length()) != 1) return false; final int altCode = altChars.codePointAt(0); return altCode >= '0' && altCode <= '9'; } @Override protected boolean onLongPress(Key key) { if (key.codes[0] == KEYCODE_OPTIONS) { int primaryCode = key.codes[0]; if (primaryCode == KEYCODE_OPTIONS) { getOnKeyboardActionListener().onKey(KEYCODE_OPTIONS_LONGPRESS, null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); return true; } else if (key.codes[0] == '0' && getKeyboard() == mPhoneKeyboard) { } else if (primaryCode == '0' && getKeyboard() == mPhoneKeyboard) { // Long pressing on 0 in phone number keypad gives you a '+'. getOnKeyboardActionListener().onKey( '+', null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, '+', null, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); return true; } else if (hasOneDigitAlternate(key)) { mKeyCodes[0] = primaryCode = key.popupCharacters.charAt(0); // when there is only one alternate character, send it as key action. getOnKeyboardActionListener().onKey(primaryCode, mKeyCodes, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE, LatinKeyboardBaseView.NOT_A_TOUCH_COORDINATE); return true; } else { Loading Loading @@ -262,7 +285,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView { return; } char c = mStringToPlay.charAt(mStringIndex); while (c > 255 || mAsciiKeys[(int) c] == null) { while (c > 255 || mAsciiKeys[c] == null) { mStringIndex++; if (mStringIndex >= mStringToPlay.length()) { mPlaying = false; Loading
java/src/com/android/inputmethod/latin/PointerTracker.java +7 −1 Original line number Diff line number Diff line Loading @@ -124,6 +124,8 @@ public class PointerTracker { } public void updateKey(int keyIndex) { if (mKeyAlreadyProcessed) return; int oldKeyIndex = mPreviousKey; mPreviousKey = keyIndex; if (keyIndex != oldKeyIndex) { Loading Loading @@ -172,6 +174,8 @@ public class PointerTracker { } public void onMoveEvent(int x, int y, long eventTime) { if (mKeyAlreadyProcessed) return; int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); if (isValidKeyIndex(keyIndex)) { if (mCurrentKey == NOT_A_KEY) { Loading Loading @@ -215,6 +219,8 @@ public class PointerTracker { } public void onUpEvent(int x, int y, long eventTime) { if (mKeyAlreadyProcessed) return; if (DEBUG) debugLog("onUpEvent :", x, y); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); Loading @@ -235,7 +241,7 @@ public class PointerTracker { } showKeyPreviewAndUpdateKey(NOT_A_KEY); // If we're not on a repeating key (which sends on a DOWN event) if (!wasInKeyRepeat && !mKeyAlreadyProcessed) { if (!wasInKeyRepeat) { detectAndSendKey(mCurrentKey, (int)x, (int)y, eventTime); } if (isValidKeyIndex(keyIndex)) Loading