am 4ac0904f: Merge "[CB20] Some more refactoring"

* commit '4ac0904f83e77530938883ccf1dcb5f4f22c6a54':
  [CB20] Some more refactoring
main
Jean Chalard 2014-04-04 05:08:15 +00:00 committed by Android Git Automerger
commit 446fbaa020
1 changed files with 10 additions and 8 deletions

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) {