Merge "Remove a useless class (B4)"

This commit is contained in:
Jean Chalard 2012-03-08 01:14:33 -08:00 committed by Android (Google) Code Review
commit f8b39f39cd
2 changed files with 0 additions and 78 deletions

View file

@ -1,68 +0,0 @@
/**
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.android.inputmethod.latin;
import android.util.Log;
public class ComposingStateManager {
private static final String TAG = ComposingStateManager.class.getSimpleName();
private static final ComposingStateManager sInstance = new ComposingStateManager();
private boolean mAutoCorrectionIndicatorOn;
private boolean mIsComposing;
public static ComposingStateManager getInstance() {
return sInstance;
}
private ComposingStateManager() {
mAutoCorrectionIndicatorOn = false;
mIsComposing = false;
}
public synchronized void onStartComposingText() {
if (!mIsComposing) {
if (LatinImeLogger.sDBG) {
Log.i(TAG, "Start composing text.");
}
mAutoCorrectionIndicatorOn = false;
mIsComposing = true;
}
}
public synchronized void onFinishComposingText() {
if (mIsComposing) {
if (LatinImeLogger.sDBG) {
Log.i(TAG, "Finish composing text.");
}
mAutoCorrectionIndicatorOn = false;
mIsComposing = false;
}
}
public synchronized boolean isAutoCorrectionIndicatorOn() {
return mAutoCorrectionIndicatorOn;
}
public synchronized void setAutoCorrectionIndicatorOn(boolean on) {
// Auto-correction indicator should be specified only when the current state is "composing".
if (!mIsComposing) return;
if (LatinImeLogger.sDBG) {
Log.i(TAG, "Set auto correction Indicator: " + on);
}
mAutoCorrectionIndicatorOn = on;
}
}

View file

@ -238,8 +238,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Keeps track of most recently inserted text (multi-character key) for reverting // Keeps track of most recently inserted text (multi-character key) for reverting
private CharSequence mEnteredText; private CharSequence mEnteredText;
private final ComposingStateManager mComposingStateManager =
ComposingStateManager.getInstance();
private boolean mIsAutoCorrectionIndicatorOn; private boolean mIsAutoCorrectionIndicatorOn;
public final UIHandler mHandler = new UIHandler(this); public final UIHandler mHandler = new UIHandler(this);
@ -658,7 +656,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override @Override
public void onConfigurationChanged(Configuration conf) { public void onConfigurationChanged(Configuration conf) {
mSubtypeSwitcher.onConfigurationChanged(conf); mSubtypeSwitcher.onConfigurationChanged(conf);
mComposingStateManager.onFinishComposingText();
// If orientation changed while predicting, commit the change // If orientation changed while predicting, commit the change
if (mDisplayOrientation != conf.orientation) { if (mDisplayOrientation != conf.orientation) {
mDisplayOrientation = conf.orientation; mDisplayOrientation = conf.orientation;
@ -1149,7 +1146,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// and the composingStateManager about it. // and the composingStateManager about it.
private void resetEntireInputState() { private void resetEntireInputState() {
resetComposingState(true /* alsoResetLastComposedWord */); resetComposingState(true /* alsoResetLastComposedWord */);
mComposingStateManager.onFinishComposingText();
updateSuggestions(); updateSuggestions();
final InputConnection ic = getCurrentInputConnection(); final InputConnection ic = getCurrentInputConnection();
if (ic != null) { if (ic != null) {
@ -1590,7 +1586,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// it entirely and resume suggestions on the previous word, we'd like to still // it entirely and resume suggestions on the previous word, we'd like to still
// have touch coordinates for it. // have touch coordinates for it.
resetComposingState(false /* alsoResetLastComposedWord */); resetComposingState(false /* alsoResetLastComposedWord */);
mComposingStateManager.onFinishComposingText();
clearSuggestions(); clearSuggestions();
} }
} }
@ -1601,7 +1596,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// If it's the first letter, make note of auto-caps state // If it's the first letter, make note of auto-caps state
if (mWordComposer.size() == 1) { if (mWordComposer.size() == 1) {
mWordComposer.setAutoCapitalized(getCurrentAutoCapsState()); mWordComposer.setAutoCapitalized(getCurrentAutoCapsState());
mComposingStateManager.onStartComposingText();
} }
ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1); ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1);
} }
@ -1633,7 +1627,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private boolean handleSeparator(final int primaryCode, final int x, final int y, private boolean handleSeparator(final int primaryCode, final int x, final int y,
final int spaceState) { final int spaceState) {
mVoiceProxy.handleSeparator(); mVoiceProxy.handleSeparator();
mComposingStateManager.onFinishComposingText();
// Should dismiss the "Touch again to save" message when handling separator // Should dismiss the "Touch again to save" message when handling separator
if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) { if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
@ -1937,7 +1930,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override @Override
public void pickSuggestionManually(final int index, final CharSequence suggestion) { public void pickSuggestionManually(final int index, final CharSequence suggestion) {
mComposingStateManager.onFinishComposingText();
final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions(); final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion, mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
mSettingsValues.mWordSeparators); mSettingsValues.mWordSeparators);
@ -2208,7 +2200,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private void restartSuggestionsOnWordBeforeCursor(final InputConnection ic, private void restartSuggestionsOnWordBeforeCursor(final InputConnection ic,
final CharSequence word) { final CharSequence word) {
mWordComposer.setComposingWord(word, mKeyboardSwitcher.getKeyboard()); mWordComposer.setComposingWord(word, mKeyboardSwitcher.getKeyboard());
mComposingStateManager.onStartComposingText();
ic.deleteSurroundingText(word.length(), 0); ic.deleteSurroundingText(word.length(), 0);
ic.setComposingText(word, 1); ic.setComposingText(word, 1);
mHandler.postUpdateSuggestions(); mHandler.postUpdateSuggestions();
@ -2240,7 +2231,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// This is the case when we cancel a manual pick. // This is the case when we cancel a manual pick.
// We should restart suggestion on the word right away. // We should restart suggestion on the word right away.
mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord); mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
mComposingStateManager.onStartComposingText();
ic.setComposingText(originallyTypedWord, 1); ic.setComposingText(originallyTypedWord, 1);
} else { } else {
ic.commitText(originallyTypedWord, 1); ic.commitText(originallyTypedWord, 1);