Skip to content
Snippets Groups Projects
Commit f8b39f39 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Remove a useless class (B4)"

parents 4b656a3f f773ef19
No related branches found
No related tags found
No related merge requests found
/**
* 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;
}
}
......@@ -238,8 +238,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// Keeps track of most recently inserted text (multi-character key) for reverting
private CharSequence mEnteredText;
private final ComposingStateManager mComposingStateManager =
ComposingStateManager.getInstance();
private boolean mIsAutoCorrectionIndicatorOn;
public final UIHandler mHandler = new UIHandler(this);
......@@ -658,7 +656,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void onConfigurationChanged(Configuration conf) {
mSubtypeSwitcher.onConfigurationChanged(conf);
mComposingStateManager.onFinishComposingText();
// If orientation changed while predicting, commit the change
if (mDisplayOrientation != conf.orientation) {
mDisplayOrientation = conf.orientation;
......@@ -1149,7 +1146,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// and the composingStateManager about it.
private void resetEntireInputState() {
resetComposingState(true /* alsoResetLastComposedWord */);
mComposingStateManager.onFinishComposingText();
updateSuggestions();
final InputConnection ic = getCurrentInputConnection();
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
// have touch coordinates for it.
resetComposingState(false /* alsoResetLastComposedWord */);
mComposingStateManager.onFinishComposingText();
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 (mWordComposer.size() == 1) {
mWordComposer.setAutoCapitalized(getCurrentAutoCapsState());
mComposingStateManager.onStartComposingText();
}
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,
final int spaceState) {
mVoiceProxy.handleSeparator();
mComposingStateManager.onFinishComposingText();
// Should dismiss the "Touch again to save" message when handling separator
if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
......@@ -1937,7 +1930,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
@Override
public void pickSuggestionManually(final int index, final CharSequence suggestion) {
mComposingStateManager.onFinishComposingText();
final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
mVoiceProxy.flushAndLogAllTextModificationCounters(index, suggestion,
mSettingsValues.mWordSeparators);
......@@ -2208,7 +2200,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private void restartSuggestionsOnWordBeforeCursor(final InputConnection ic,
final CharSequence word) {
mWordComposer.setComposingWord(word, mKeyboardSwitcher.getKeyboard());
mComposingStateManager.onStartComposingText();
ic.deleteSurroundingText(word.length(), 0);
ic.setComposingText(word, 1);
mHandler.postUpdateSuggestions();
......@@ -2240,7 +2231,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// This is the case when we cancel a manual pick.
// We should restart suggestion on the word right away.
mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
mComposingStateManager.onStartComposingText();
ic.setComposingText(originallyTypedWord, 1);
} else {
ic.commitText(originallyTypedWord, 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment