Loading java/src/com/android/inputmethod/latin/LatinIME.java +30 −18 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.accessibility.AccessibilityUtils; Loading Loading @@ -142,7 +141,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private SharedPreferences mPrefs; @UsedForTesting final KeyboardSwitcher mKeyboardSwitcher; private final SubtypeSwitcher mSubtypeSwitcher; private boolean mShouldSwitchToLastSubtype = true; private final SubtypeState mSubtypeState = new SubtypeState(); private boolean mIsMainDictionaryAvailable; private UserBinaryDictionary mUserDictionary; Loading Loading @@ -366,6 +365,33 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } } static final class SubtypeState { private InputMethodSubtype mLastActiveSubtype; private boolean mCurrentSubtypeUsed; public void currentSubtypeUsed() { mCurrentSubtypeUsed = true; } public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) { final InputMethodSubtype currentSubtype = richImm.getInputMethodManager() .getCurrentInputMethodSubtype(); final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype; final boolean currentSubtypeUsed = mCurrentSubtypeUsed; if (currentSubtypeUsed) { mLastActiveSubtype = currentSubtype; mCurrentSubtypeUsed = false; } if (currentSubtypeUsed && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype) && !currentSubtype.equals(lastActiveSubtype)) { richImm.setInputMethodAndSubtype(token, lastActiveSubtype); return; } richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */); } } public LatinIME() { super(); mSubtypeSwitcher = SubtypeSwitcher.getInstance(); Loading Loading @@ -893,6 +919,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Make a note of the cursor position mLastSelectionStart = newSelStart; mLastSelectionEnd = newSelEnd; mSubtypeState.currentSubtypeUsed(); } /** Loading Loading @@ -1240,20 +1267,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mRichImm.switchToNextInputMethod(token, false /* onlyCurrentIme */); return; } if (mShouldSwitchToLastSubtype) { final InputMethodManager imm = mRichImm.getInputMethodManager(); final InputMethodSubtype lastSubtype = imm.getLastInputMethodSubtype(); final boolean lastSubtypeBelongsToThisIme = mRichImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastSubtype); if (lastSubtypeBelongsToThisIme && imm.switchToLastInputMethod(token)) { mShouldSwitchToLastSubtype = false; } else { mRichImm.switchToNextInputMethod(token, true /* onlyCurrentIme */); mShouldSwitchToLastSubtype = true; } } else { mRichImm.switchToNextInputMethod(token, true /* onlyCurrentIme */); } mSubtypeState.switchSubtype(token, mRichImm); } private void sendDownUpKeyEventForBackwardCompatibility(final int code) { Loading Loading @@ -1322,7 +1336,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction handleBackspace(spaceState); mDeleteCount++; mExpectingUpdateSelection = true; mShouldSwitchToLastSubtype = true; LatinImeLogger.logOnDelete(x, y); break; case Constants.CODE_SHIFT: Loading Loading @@ -1378,7 +1391,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction handleCharacter(primaryCode, keyX, keyY, spaceState); } mExpectingUpdateSelection = true; mShouldSwitchToLastSubtype = true; break; } switcher.onCodeInput(primaryCode); Loading java/src/com/android/inputmethod/latin/RichInputMethodManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -206,6 +206,11 @@ public final class RichInputMethodManager { return null; } public void setInputMethodAndSubtype(final IBinder token, final InputMethodSubtype subtype) { mImmWrapper.mImm.setInputMethodAndSubtype( token, mInputMethodInfoOfThisIme.getId(), subtype); } public void setAdditionalInputMethodSubtypes(final InputMethodSubtype[] subtypes) { mImmWrapper.mImm.setAdditionalInputMethodSubtypes( mInputMethodInfoOfThisIme.getId(), subtypes); Loading Loading
java/src/com/android/inputmethod/latin/LatinIME.java +30 −18 Original line number Diff line number Diff line Loading @@ -56,7 +56,6 @@ import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; import com.android.inputmethod.accessibility.AccessibilityUtils; Loading Loading @@ -142,7 +141,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction private SharedPreferences mPrefs; @UsedForTesting final KeyboardSwitcher mKeyboardSwitcher; private final SubtypeSwitcher mSubtypeSwitcher; private boolean mShouldSwitchToLastSubtype = true; private final SubtypeState mSubtypeState = new SubtypeState(); private boolean mIsMainDictionaryAvailable; private UserBinaryDictionary mUserDictionary; Loading Loading @@ -366,6 +365,33 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } } static final class SubtypeState { private InputMethodSubtype mLastActiveSubtype; private boolean mCurrentSubtypeUsed; public void currentSubtypeUsed() { mCurrentSubtypeUsed = true; } public void switchSubtype(final IBinder token, final RichInputMethodManager richImm) { final InputMethodSubtype currentSubtype = richImm.getInputMethodManager() .getCurrentInputMethodSubtype(); final InputMethodSubtype lastActiveSubtype = mLastActiveSubtype; final boolean currentSubtypeUsed = mCurrentSubtypeUsed; if (currentSubtypeUsed) { mLastActiveSubtype = currentSubtype; mCurrentSubtypeUsed = false; } if (currentSubtypeUsed && richImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastActiveSubtype) && !currentSubtype.equals(lastActiveSubtype)) { richImm.setInputMethodAndSubtype(token, lastActiveSubtype); return; } richImm.switchToNextInputMethod(token, true /* onlyCurrentIme */); } } public LatinIME() { super(); mSubtypeSwitcher = SubtypeSwitcher.getInstance(); Loading Loading @@ -893,6 +919,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction // Make a note of the cursor position mLastSelectionStart = newSelStart; mLastSelectionEnd = newSelEnd; mSubtypeState.currentSubtypeUsed(); } /** Loading Loading @@ -1240,20 +1267,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mRichImm.switchToNextInputMethod(token, false /* onlyCurrentIme */); return; } if (mShouldSwitchToLastSubtype) { final InputMethodManager imm = mRichImm.getInputMethodManager(); final InputMethodSubtype lastSubtype = imm.getLastInputMethodSubtype(); final boolean lastSubtypeBelongsToThisIme = mRichImm.checkIfSubtypeBelongsToThisImeAndEnabled(lastSubtype); if (lastSubtypeBelongsToThisIme && imm.switchToLastInputMethod(token)) { mShouldSwitchToLastSubtype = false; } else { mRichImm.switchToNextInputMethod(token, true /* onlyCurrentIme */); mShouldSwitchToLastSubtype = true; } } else { mRichImm.switchToNextInputMethod(token, true /* onlyCurrentIme */); } mSubtypeState.switchSubtype(token, mRichImm); } private void sendDownUpKeyEventForBackwardCompatibility(final int code) { Loading Loading @@ -1322,7 +1336,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction handleBackspace(spaceState); mDeleteCount++; mExpectingUpdateSelection = true; mShouldSwitchToLastSubtype = true; LatinImeLogger.logOnDelete(x, y); break; case Constants.CODE_SHIFT: Loading Loading @@ -1378,7 +1391,6 @@ public final class LatinIME extends InputMethodService implements KeyboardAction handleCharacter(primaryCode, keyX, keyY, spaceState); } mExpectingUpdateSelection = true; mShouldSwitchToLastSubtype = true; break; } switcher.onCodeInput(primaryCode); Loading
java/src/com/android/inputmethod/latin/RichInputMethodManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -206,6 +206,11 @@ public final class RichInputMethodManager { return null; } public void setInputMethodAndSubtype(final IBinder token, final InputMethodSubtype subtype) { mImmWrapper.mImm.setInputMethodAndSubtype( token, mInputMethodInfoOfThisIme.getId(), subtype); } public void setAdditionalInputMethodSubtypes(final InputMethodSubtype[] subtypes) { mImmWrapper.mImm.setAdditionalInputMethodSubtypes( mInputMethodInfoOfThisIme.getId(), subtypes); Loading