From 0f913ff5ba71c40a4492994a23010336cd25be8e Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Tue, 25 Mar 2014 22:43:13 +0900 Subject: [PATCH] [CB19] Some refactoring Bug: 13406701 Change-Id: Ie4d420e8cabbbd93c3eea13a80baa4d766ee61d0 --- .../android/inputmethod/latin/WordComposer.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index 50bc2b0a2..f31fb134c 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -173,9 +173,7 @@ public final class WordComposer { final int keyX = event.mX; final int keyY = event.mY; final int newIndex = size(); - mCombinerChain.processEvent(mEvents, event); - mEvents.add(event); - refreshTypedWordCache(); + processEvent(event); mCursorPositionWithinWord = mCodePointSize; if (newIndex < MAX_WORD_LENGTH) { mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE @@ -200,13 +198,17 @@ public final class WordComposer { mAutoCorrection = null; } + private void processEvent(final Event event) { + mCombinerChain.processEvent(mEvents, event); + mEvents.add(event); + refreshTypedWordCache(); + } + /** * Delete the last composing unit as a result of hitting backspace. */ public void deleteLast(final Event event) { - mCombinerChain.processEvent(mEvents, event); - mEvents.add(event); - refreshTypedWordCache(); + processEvent(event); // We may have deleted the last one. if (0 == size()) { mIsFirstCharCapitalized = false;