Loading java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +1 −2 Original line number Diff line number Diff line Loading @@ -137,8 +137,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, mKeyboardSet = builder.build(); final KeyboardId mainKeyboardId = mKeyboardSet.getMainKeyboardId(); try { mState.onLoadKeyboard(mResources.getString(R.string.layout_switch_back_symbols), hasDistinctMultitouch()); mState.onLoadKeyboard(mResources.getString(R.string.layout_switch_back_symbols)); } catch (RuntimeException e) { Log.w(TAG, "loading keyboard failed: " + mainKeyboardId, e); LatinImeLogger.logOnException(mainKeyboardId.toString(), e); Loading java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +11 −15 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import com.android.inputmethod.keyboard.Keyboard; * * This class contains all keyboard state transition logic. * * The input events are {@link #onLoadKeyboard(String, boolean)}, {@link #onSaveKeyboardState()}, * The input events are {@link #onLoadKeyboard(String)}, {@link #onSaveKeyboardState()}, * {@link #onPressKey(int)}, {@link #onReleaseKey(int, boolean)}, * {@link #onCodeInput(int, boolean, boolean)}, {@link #onCancelInput(boolean)}, * {@link #onUpdateShiftState(boolean)}. Loading Loading @@ -74,7 +74,6 @@ public class KeyboardState { private int mSwitchState = SWITCH_STATE_ALPHA; private String mLayoutSwitchBackSymbols; private boolean mHasDistinctMultitouch; private final SwitchActions mSwitchActions; Loading @@ -95,12 +94,11 @@ public class KeyboardState { mSwitchActions = switchActions; } public void onLoadKeyboard(String layoutSwitchBackSymbols, boolean hasDistinctMultitouch) { public void onLoadKeyboard(String layoutSwitchBackSymbols) { if (DEBUG_EVENT) { Log.d(TAG, "onLoadKeyboard"); } mLayoutSwitchBackSymbols = layoutSwitchBackSymbols; mHasDistinctMultitouch = hasDistinctMultitouch; mKeyboardShiftState.setShifted(false); mKeyboardShiftState.setShiftLocked(false); mShiftKeyState.onRelease(); Loading Loading @@ -164,18 +162,16 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode)); } if (shiftMode == SwitchActions.AUTOMATIC_SHIFT) { switch (shiftMode) { case SwitchActions.AUTOMATIC_SHIFT: mKeyboardShiftState.setAutomaticTemporaryUpperCase(); } else { final boolean shifted = (shiftMode == SwitchActions.MANUAL_SHIFT); // On non-distinct multi touch panel device, we should also turn off the shift locked // state when shift key is pressed to go to normal mode. // On the other hand, on distinct multi touch panel device, turning off the shift // locked state with shift key pressing is handled by onReleaseShift(). if (!mHasDistinctMultitouch && !shifted && mKeyboardShiftState.isShiftLocked()) { mSwitchActions.setShiftLocked(false); } mKeyboardShiftState.setShifted(shifted); break; case SwitchActions.MANUAL_SHIFT: mKeyboardShiftState.setShifted(true); break; case SwitchActions.UNSHIFT: mKeyboardShiftState.setShifted(false); break; } mSwitchActions.setShifted(shiftMode); } Loading tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java→tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java +2 −7 Original line number Diff line number Diff line /* * Copyright (C) 2011 The Android Open Source Project * Copyright (C) 2012 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 Loading @@ -16,12 +16,7 @@ package com.android.inputmethod.keyboard.internal; public class KeyboardStateTests extends KeyboardStateNonDistinctTests { @Override public boolean hasDistinctMultitouch() { return true; } public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { // Shift key chording input. public void testShiftChording() { // Press shift key and hold, enter into choring shift state. Loading tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateNonDistinctTests.java→tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateSingleTouchTests.java +1 −6 Original line number Diff line number Diff line Loading @@ -16,12 +16,7 @@ package com.android.inputmethod.keyboard.internal; public class KeyboardStateNonDistinctTests extends KeyboardStateTestsBase { @Override public boolean hasDistinctMultitouch() { return false; } public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase { // Shift key in alphabet mode. public void testShift() { // Press/release shift key, enter into shift state. Loading tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java +1 −3 Original line number Diff line number Diff line Loading @@ -22,8 +22,6 @@ public abstract class KeyboardStateTestsBase extends AndroidTestCase implements MockKeyboardSwitcher.Constants { protected MockKeyboardSwitcher mSwitcher; public abstract boolean hasDistinctMultitouch(); @Override protected void setUp() throws Exception { super.setUp(); Loading @@ -45,7 +43,7 @@ public abstract class KeyboardStateTestsBase extends AndroidTestCase } public void loadKeyboard(String layoutSwitchBackSymbols, int afterLoad) { mSwitcher.loadKeyboard(layoutSwitchBackSymbols, hasDistinctMultitouch()); mSwitcher.loadKeyboard(layoutSwitchBackSymbols); updateShiftState(afterLoad); } Loading Loading
java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +1 −2 Original line number Diff line number Diff line Loading @@ -137,8 +137,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions, mKeyboardSet = builder.build(); final KeyboardId mainKeyboardId = mKeyboardSet.getMainKeyboardId(); try { mState.onLoadKeyboard(mResources.getString(R.string.layout_switch_back_symbols), hasDistinctMultitouch()); mState.onLoadKeyboard(mResources.getString(R.string.layout_switch_back_symbols)); } catch (RuntimeException e) { Log.w(TAG, "loading keyboard failed: " + mainKeyboardId, e); LatinImeLogger.logOnException(mainKeyboardId.toString(), e); Loading
java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +11 −15 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ import com.android.inputmethod.keyboard.Keyboard; * * This class contains all keyboard state transition logic. * * The input events are {@link #onLoadKeyboard(String, boolean)}, {@link #onSaveKeyboardState()}, * The input events are {@link #onLoadKeyboard(String)}, {@link #onSaveKeyboardState()}, * {@link #onPressKey(int)}, {@link #onReleaseKey(int, boolean)}, * {@link #onCodeInput(int, boolean, boolean)}, {@link #onCancelInput(boolean)}, * {@link #onUpdateShiftState(boolean)}. Loading Loading @@ -74,7 +74,6 @@ public class KeyboardState { private int mSwitchState = SWITCH_STATE_ALPHA; private String mLayoutSwitchBackSymbols; private boolean mHasDistinctMultitouch; private final SwitchActions mSwitchActions; Loading @@ -95,12 +94,11 @@ public class KeyboardState { mSwitchActions = switchActions; } public void onLoadKeyboard(String layoutSwitchBackSymbols, boolean hasDistinctMultitouch) { public void onLoadKeyboard(String layoutSwitchBackSymbols) { if (DEBUG_EVENT) { Log.d(TAG, "onLoadKeyboard"); } mLayoutSwitchBackSymbols = layoutSwitchBackSymbols; mHasDistinctMultitouch = hasDistinctMultitouch; mKeyboardShiftState.setShifted(false); mKeyboardShiftState.setShiftLocked(false); mShiftKeyState.onRelease(); Loading Loading @@ -164,18 +162,16 @@ public class KeyboardState { if (DEBUG_ACTION) { Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode)); } if (shiftMode == SwitchActions.AUTOMATIC_SHIFT) { switch (shiftMode) { case SwitchActions.AUTOMATIC_SHIFT: mKeyboardShiftState.setAutomaticTemporaryUpperCase(); } else { final boolean shifted = (shiftMode == SwitchActions.MANUAL_SHIFT); // On non-distinct multi touch panel device, we should also turn off the shift locked // state when shift key is pressed to go to normal mode. // On the other hand, on distinct multi touch panel device, turning off the shift // locked state with shift key pressing is handled by onReleaseShift(). if (!mHasDistinctMultitouch && !shifted && mKeyboardShiftState.isShiftLocked()) { mSwitchActions.setShiftLocked(false); } mKeyboardShiftState.setShifted(shifted); break; case SwitchActions.MANUAL_SHIFT: mKeyboardShiftState.setShifted(true); break; case SwitchActions.UNSHIFT: mKeyboardShiftState.setShifted(false); break; } mSwitchActions.setShifted(shiftMode); } Loading
tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTests.java→tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateMultiTouchTests.java +2 −7 Original line number Diff line number Diff line /* * Copyright (C) 2011 The Android Open Source Project * Copyright (C) 2012 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 Loading @@ -16,12 +16,7 @@ package com.android.inputmethod.keyboard.internal; public class KeyboardStateTests extends KeyboardStateNonDistinctTests { @Override public boolean hasDistinctMultitouch() { return true; } public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase { // Shift key chording input. public void testShiftChording() { // Press shift key and hold, enter into choring shift state. Loading
tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateNonDistinctTests.java→tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateSingleTouchTests.java +1 −6 Original line number Diff line number Diff line Loading @@ -16,12 +16,7 @@ package com.android.inputmethod.keyboard.internal; public class KeyboardStateNonDistinctTests extends KeyboardStateTestsBase { @Override public boolean hasDistinctMultitouch() { return false; } public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase { // Shift key in alphabet mode. public void testShift() { // Press/release shift key, enter into shift state. Loading
tests/src/com/android/inputmethod/keyboard/internal/KeyboardStateTestsBase.java +1 −3 Original line number Diff line number Diff line Loading @@ -22,8 +22,6 @@ public abstract class KeyboardStateTestsBase extends AndroidTestCase implements MockKeyboardSwitcher.Constants { protected MockKeyboardSwitcher mSwitcher; public abstract boolean hasDistinctMultitouch(); @Override protected void setUp() throws Exception { super.setUp(); Loading @@ -45,7 +43,7 @@ public abstract class KeyboardStateTestsBase extends AndroidTestCase } public void loadKeyboard(String layoutSwitchBackSymbols, int afterLoad) { mSwitcher.loadKeyboard(layoutSwitchBackSymbols, hasDistinctMultitouch()); mSwitcher.loadKeyboard(layoutSwitchBackSymbols); updateShiftState(afterLoad); } Loading