am 68d7291a: Merge "[IL77] Remove refs to Settings from InputLogic"

* commit '68d7291a6bdc1d5633d744759a5c76599499d9e9':
  [IL77] Remove refs to Settings from InputLogic
main
Jean Chalard 2014-01-27 01:35:46 -08:00 committed by Android Git Automerger
commit d7c3ceac59
2 changed files with 6 additions and 11 deletions

View File

@ -1183,7 +1183,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// the right layout. // the right layout.
// TODO[IL]: Remove this, pass the input logic to the keyboard switcher instead? // TODO[IL]: Remove this, pass the input logic to the keyboard switcher instead?
public int getCurrentAutoCapsState() { public int getCurrentAutoCapsState() {
return mInputLogic.getCurrentAutoCapsState(null /* optionalSettingsValues */); return mInputLogic.getCurrentAutoCapsState(Settings.getInstance().getCurrent());
} }
// Called from the KeyboardSwitcher which needs to know recaps state to display // Called from the KeyboardSwitcher which needs to know recaps state to display
@ -1289,7 +1289,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSubtypeSwitcher.switchToShortcutIME(this); mSubtypeSwitcher.switchToShortcutIME(this);
// Still call the *#onCodeInput methods for readability. // Still call the *#onCodeInput methods for readability.
} }
mInputLogic.onCodeInput(codeToSend, keyX, keyY, mHandler, mKeyboardSwitcher); mInputLogic.onCodeInput(codeToSend, keyX, keyY, Settings.getInstance().getCurrent(),
mHandler, mKeyboardSwitcher);
mKeyboardSwitcher.onCodeInput(codePoint); mKeyboardSwitcher.onCodeInput(codePoint);
} }

View File

@ -42,7 +42,6 @@ import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.WordComposer;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.settings.Settings;
import com.android.inputmethod.latin.settings.SettingsValues; import com.android.inputmethod.latin.settings.SettingsValues;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations; import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
import com.android.inputmethod.latin.utils.AsyncResultHolder; import com.android.inputmethod.latin.utils.AsyncResultHolder;
@ -191,12 +190,12 @@ public final class InputLogic {
* @param y the y-coordinate where the user pressed the key, or NOT_A_COORDINATE. * @param y the y-coordinate where the user pressed the key, or NOT_A_COORDINATE.
*/ */
public void onCodeInput(final int code, final int x, final int y, public void onCodeInput(final int code, final int x, final int y,
final SettingsValues settingsValues,
// TODO: remove these two arguments // TODO: remove these two arguments
final LatinIME.UIHandler handler, final KeyboardSwitcher keyboardSwitcher) { final LatinIME.UIHandler handler, final KeyboardSwitcher keyboardSwitcher) {
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_onCodeInput(code, x, y); ResearchLogger.latinIME_onCodeInput(code, x, y);
} }
final SettingsValues settingsValues = Settings.getInstance().getCurrent();
final long when = SystemClock.uptimeMillis(); final long when = SystemClock.uptimeMillis();
if (code != Constants.CODE_DELETE if (code != Constants.CODE_DELETE
|| when > mLastKeyTime + Constants.LONG_PRESS_MILLISECONDS) { || when > mLastKeyTime + Constants.LONG_PRESS_MILLISECONDS) {
@ -1255,15 +1254,10 @@ public final class InputLogic {
* This is called from the KeyboardSwitcher (through a trampoline in LatinIME) because it * This is called from the KeyboardSwitcher (through a trampoline in LatinIME) because it
* needs to know auto caps state to display the right layout. * needs to know auto caps state to display the right layout.
* *
* @param optionalSettingsValues settings values, or null if we should just get the current ones * @param settingsValues the relevant settings values
* from the singleton.
* @return a caps mode from TextUtils.CAP_MODE_* or Constants.TextUtils.CAP_MODE_OFF. * @return a caps mode from TextUtils.CAP_MODE_* or Constants.TextUtils.CAP_MODE_OFF.
*/ */
public int getCurrentAutoCapsState(final SettingsValues optionalSettingsValues) { public int getCurrentAutoCapsState(final SettingsValues settingsValues) {
// If we are in a batch edit, we need to use the same settings values as the outside
// code, that will pass it to us. Otherwise, we can just take the current values.
final SettingsValues settingsValues = null != optionalSettingsValues
? optionalSettingsValues : Settings.getInstance().getCurrent();
if (!settingsValues.mAutoCap) return Constants.TextUtils.CAP_MODE_OFF; if (!settingsValues.mAutoCap) return Constants.TextUtils.CAP_MODE_OFF;
final EditorInfo ei = getCurrentInputEditorInfo(); final EditorInfo ei = getCurrentInputEditorInfo();