am 52a2682b: [IL35] Preparative cleanup

* commit '52a2682b99fc57dea974b21f3d606ed53a802e60':
  [IL35] Preparative cleanup
main
Jean Chalard 2013-12-25 19:33:34 -08:00 committed by Android Git Automerger
commit 8d2f602609
2 changed files with 14 additions and 13 deletions

View File

@ -1272,7 +1272,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override @Override
public void onCancelBatchInput() { public void onCancelBatchInput() {
mInputLogic.onCancelBatchInput(mInputUpdater); mInputLogic.onCancelBatchInput(mHandler, mInputUpdater);
} }
// TODO[IL]: Make this a package-private standalone class in inputlogic/ and remove all // TODO[IL]: Make this a package-private standalone class in inputlogic/ and remove all
@ -1310,17 +1310,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
return true; return true;
} }
// Run in the UI thread. // Run on the UI thread.
public void onStartBatchInput() { public void onStartBatchInput() {
synchronized (mLock) { synchronized (mLock) {
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
mInBatchInput = true; mInBatchInput = true;
mLatinIme.mHandler.showGesturePreviewAndSuggestionStrip(
SuggestedWords.EMPTY, false /* dismissGestureFloatingPreviewText */);
} }
} }
// Run in the Handler thread. // Run on the Handler thread.
private void updateBatchInput(final InputPointers batchPointers, final int sequenceNumber) { private void updateBatchInput(final InputPointers batchPointers, final int sequenceNumber) {
synchronized (mLock) { synchronized (mLock) {
if (!mInBatchInput) { if (!mInBatchInput) {
@ -1339,7 +1337,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
// Run in the UI thread. // Run on the UI thread.
public void onUpdateBatchInput(final InputPointers batchPointers, public void onUpdateBatchInput(final InputPointers batchPointers,
final int sequenceNumber) { final int sequenceNumber) {
if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) { if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) {
@ -1352,12 +1350,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void onCancelBatchInput() { public void onCancelBatchInput() {
synchronized (mLock) { synchronized (mLock) {
mInBatchInput = false; mInBatchInput = false;
mLatinIme.mHandler.showGesturePreviewAndSuggestionStrip(
SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */);
} }
} }
// Run in the UI thread. // Run on the UI thread.
public void onEndBatchInput(final InputPointers batchPointers) { public void onEndBatchInput(final InputPointers batchPointers) {
synchronized(mLock) { synchronized(mLock) {
getSuggestedWordsGestureLocked(batchPointers, SuggestedWords.NOT_A_SEQUENCE_NUMBER, getSuggestedWordsGestureLocked(batchPointers, SuggestedWords.NOT_A_SEQUENCE_NUMBER,
@ -1407,7 +1403,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
// This method must run in UI Thread. // This method must run on the UI Thread.
private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords, private void showGesturePreviewAndSuggestionStrip(final SuggestedWords suggestedWords,
final boolean dismissGestureFloatingPreviewText) { final boolean dismissGestureFloatingPreviewText) {
showSuggestionStrip(suggestedWords); showSuggestionStrip(suggestedWords);
@ -1418,7 +1414,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
} }
// This method must run in UI Thread. // This method must run on the UI Thread.
public void onEndBatchInputAsyncInternal(final SuggestedWords suggestedWords) { public void onEndBatchInputAsyncInternal(final SuggestedWords suggestedWords) {
final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0); final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0);
if (TextUtils.isEmpty(batchInputText)) { if (TextUtils.isEmpty(batchInputText)) {

View File

@ -303,6 +303,8 @@ public final class InputLogic {
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler, final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler,
final LatinIME.InputUpdater inputUpdater) { final LatinIME.InputUpdater inputUpdater) {
inputUpdater.onStartBatchInput(); inputUpdater.onStartBatchInput();
handler.showGesturePreviewAndSuggestionStrip(
SuggestedWords.EMPTY, false /* dismissGestureFloatingPreviewText */);
handler.cancelUpdateSuggestionStrip(); handler.cancelUpdateSuggestionStrip();
mConnection.beginBatchEdit(); mConnection.beginBatchEdit();
if (mWordComposer.isComposingWord()) { if (mWordComposer.isComposingWord()) {
@ -403,9 +405,12 @@ public final class InputLogic {
inputUpdater.onEndBatchInput(batchPointers); inputUpdater.onEndBatchInput(batchPointers);
} }
// TODO: remove this argument // TODO: remove these arguments
public void onCancelBatchInput(final LatinIME.InputUpdater inputUpdater) { public void onCancelBatchInput(final LatinIME.UIHandler handler,
final LatinIME.InputUpdater inputUpdater) {
inputUpdater.onCancelBatchInput(); inputUpdater.onCancelBatchInput();
handler.showGesturePreviewAndSuggestionStrip(
SuggestedWords.EMPTY, true /* dismissGestureFloatingPreviewText */);
} }
/** /**