am da5c2069: Merge "[CB23] Merge add and deleteLast"

* commit 'da5c20693421d087c56707c95edcf19fc153c12a':
  [CB23] Merge add and deleteLast
main
Jean Chalard 2014-04-07 08:42:15 +00:00 committed by Android Git Automerger
commit 3d972f85d2
2 changed files with 11 additions and 18 deletions

View File

@ -165,14 +165,14 @@ public final class WordComposer {
} }
/** /**
* Add a new event for a key stroke, with the pressed key's code point with the touch point * Process an input event.
* coordinates. *
* All input events should be supported, including software/hardware events, characters as well
* as deletions, multiple inputs and gestures.
*
* @param event the event to process.
*/ */
public void add(final Event event) { public void processEvent(final Event event) {
processEvent(event);
}
private void processEvent(final Event event) {
final int primaryCode = event.mCodePoint; final int primaryCode = event.mCodePoint;
final int keyX = event.mX; final int keyX = event.mX;
final int keyY = event.mY; final int keyY = event.mY;
@ -223,13 +223,6 @@ public final class WordComposer {
mAutoCorrection = null; mAutoCorrection = null;
} }
/**
* Delete the last composing unit as a result of hitting backspace.
*/
public void deleteLast(final Event event) {
processEvent(event);
}
public void setCursorPositionWithinWord(final int posWithinWord) { public void setCursorPositionWithinWord(final int posWithinWord) {
mCursorPositionWithinWord = posWithinWord; mCursorPositionWithinWord = posWithinWord;
// TODO: compute where that puts us inside the events // TODO: compute where that puts us inside the events
@ -301,7 +294,7 @@ public final class WordComposer {
final int codePoint = Character.codePointAt(word, i); final int codePoint = Character.codePointAt(word, i);
// We don't want to override the batch input points that are held in mInputPointers // We don't want to override the batch input points that are held in mInputPointers
// (See {@link #add(int,int,int)}). // (See {@link #add(int,int,int)}).
add(Event.createEventForCodePointFromUnknownSource(codePoint)); processEvent(Event.createEventForCodePointFromUnknownSource(codePoint));
} }
} }
@ -318,7 +311,7 @@ public final class WordComposer {
reset(); reset();
final int length = codePoints.length; final int length = codePoints.length;
for (int i = 0; i < length; ++i) { for (int i = 0; i < length; ++i) {
add(Event.createEventForCodePointFromAlreadyTypedText(codePoints[i], processEvent(Event.createEventForCodePointFromAlreadyTypedText(codePoints[i],
CoordinateUtils.xFromArray(coordinates, i), CoordinateUtils.xFromArray(coordinates, i),
CoordinateUtils.yFromArray(coordinates, i))); CoordinateUtils.yFromArray(coordinates, i)));
} }

View File

@ -727,7 +727,7 @@ public final class InputLogic {
resetComposingState(false /* alsoResetLastComposedWord */); resetComposingState(false /* alsoResetLastComposedWord */);
} }
if (isComposingWord) { if (isComposingWord) {
mWordComposer.add(inputTransaction.mEvent); mWordComposer.processEvent(inputTransaction.mEvent);
// If it's the first letter, make note of auto-caps state // If it's the first letter, make note of auto-caps state
if (mWordComposer.isSingleLetter()) { if (mWordComposer.isSingleLetter()) {
// We pass 1 to getPreviousWordForSuggestion because we were not composing a word // We pass 1 to getPreviousWordForSuggestion because we were not composing a word
@ -893,7 +893,7 @@ public final class InputLogic {
mWordComposer.reset(); mWordComposer.reset();
mWordComposer.setRejectedBatchModeSuggestion(rejectedSuggestion); mWordComposer.setRejectedBatchModeSuggestion(rejectedSuggestion);
} else { } else {
mWordComposer.deleteLast(inputTransaction.mEvent); mWordComposer.processEvent(inputTransaction.mEvent);
} }
mConnection.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1); mConnection.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1);
inputTransaction.setRequiresUpdateSuggestions(); inputTransaction.setRequiresUpdateSuggestions();