Merge "Very simple refactoring"

main
Jean Chalard 2013-07-26 05:30:46 +00:00 committed by Android (Google) Code Review
commit 0dd23544ff
1 changed files with 7 additions and 3 deletions

View File

@ -139,13 +139,17 @@ public final class RichInputConnection {
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
} }
public void resetCachesUponCursorMove(final int newCursorPosition, private void refreshCache() {
final boolean shouldFinishComposition) {
mCurrentCursorPosition = newCursorPosition;
mComposingText.setLength(0); mComposingText.setLength(0);
mCommittedTextBeforeComposingText.setLength(0); mCommittedTextBeforeComposingText.setLength(0);
final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0); final CharSequence textBeforeCursor = getTextBeforeCursor(DEFAULT_TEXT_CACHE_SIZE, 0);
if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor); if (null != textBeforeCursor) mCommittedTextBeforeComposingText.append(textBeforeCursor);
}
public void resetCachesUponCursorMove(final int newCursorPosition,
final boolean shouldFinishComposition) {
mCurrentCursorPosition = newCursorPosition;
refreshCache();
if (null != mIC && shouldFinishComposition) { if (null != mIC && shouldFinishComposition) {
mIC.finishComposingText(); mIC.finishComposingText();
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {