[CB20] Some more refactoring

Bug: 13406701
Change-Id: I4502658f4f1e1997d0ac245d95e2d4a1415b1861
This commit is contained in:
Jean Chalard 2014-03-25 22:44:59 +09:00
parent 0f913ff5ba
commit dfaeb125eb

View File

@ -174,7 +174,6 @@ public final class WordComposer {
final int keyY = event.mY; final int keyY = event.mY;
final int newIndex = size(); final int newIndex = size();
processEvent(event); processEvent(event);
mCursorPositionWithinWord = mCodePointSize;
if (newIndex < MAX_WORD_LENGTH) { if (newIndex < MAX_WORD_LENGTH) {
mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE mPrimaryKeyCodes[newIndex] = primaryCode >= Constants.CODE_SPACE
? Character.toLowerCase(primaryCode) : primaryCode; ? Character.toLowerCase(primaryCode) : primaryCode;
@ -195,13 +194,22 @@ public final class WordComposer {
} else { } else {
mTrailingSingleQuotesCount = 0; mTrailingSingleQuotesCount = 0;
} }
mAutoCorrection = null;
} }
private void processEvent(final Event event) { private void processEvent(final Event event) {
final int primaryCode = event.mCodePoint;
final int keyX = event.mX;
final int keyY = event.mY;
final int newIndex = size();
mCombinerChain.processEvent(mEvents, event); mCombinerChain.processEvent(mEvents, event);
mEvents.add(event); mEvents.add(event);
refreshTypedWordCache(); refreshTypedWordCache();
mCursorPositionWithinWord = mCodePointSize;
// We may have deleted the last one.
if (0 == mCodePointSize) {
mIsFirstCharCapitalized = false;
}
mAutoCorrection = null;
} }
/** /**
@ -209,10 +217,6 @@ public final class WordComposer {
*/ */
public void deleteLast(final Event event) { public void deleteLast(final Event event) {
processEvent(event); processEvent(event);
// We may have deleted the last one.
if (0 == size()) {
mIsFirstCharCapitalized = false;
}
if (mTrailingSingleQuotesCount > 0) { if (mTrailingSingleQuotesCount > 0) {
--mTrailingSingleQuotesCount; --mTrailingSingleQuotesCount;
} else { } else {
@ -225,8 +229,6 @@ public final class WordComposer {
++mTrailingSingleQuotesCount; ++mTrailingSingleQuotesCount;
} }
} }
mCursorPositionWithinWord = mCodePointSize;
mAutoCorrection = null;
} }
public void setCursorPositionWithinWord(final int posWithinWord) { public void setCursorPositionWithinWord(final int posWithinWord) {