Merge "Refactor symbol key state into KeyboardSwitcher"
commit
89cfd23f34
|
@ -75,6 +75,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
private final LatinIME mInputMethodService;
|
private final LatinIME mInputMethodService;
|
||||||
private final LanguageSwitcher mLanguageSwitcher;
|
private final LanguageSwitcher mLanguageSwitcher;
|
||||||
|
|
||||||
|
private ModifierKeyState mSymbolKeyState = new ModifierKeyState();
|
||||||
private KeyboardId mSymbolsId;
|
private KeyboardId mSymbolsId;
|
||||||
private KeyboardId mSymbolsShiftedId;
|
private KeyboardId mSymbolsShiftedId;
|
||||||
|
|
||||||
|
@ -382,6 +383,23 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
mInputView.setShiftLocked(shiftLocked);
|
mInputView.setShiftLocked(shiftLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onPressSymbol() {
|
||||||
|
mSymbolKeyState.onPress();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onReleaseSymbol() {
|
||||||
|
mSymbolKeyState.onRelease();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSymbolMomentary() {
|
||||||
|
return mSymbolKeyState.isMomentary();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onOtherKeyPressed() {
|
||||||
|
// TODO: shift key state will be handled too.
|
||||||
|
mSymbolKeyState.onOtherKeyPressed();
|
||||||
|
}
|
||||||
|
|
||||||
public void toggleShift() {
|
public void toggleShift() {
|
||||||
if (isAlphabetMode())
|
if (isAlphabetMode())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -241,7 +241,6 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
// Modifier keys state
|
// Modifier keys state
|
||||||
private final ModifierKeyState mShiftKeyState = new ModifierKeyState();
|
private final ModifierKeyState mShiftKeyState = new ModifierKeyState();
|
||||||
private final ModifierKeyState mSymbolKeyState = new ModifierKeyState();
|
|
||||||
|
|
||||||
private Tutorial mTutorial;
|
private Tutorial mTutorial;
|
||||||
|
|
||||||
|
@ -2323,11 +2322,11 @@ public class LatinIME extends InputMethodService
|
||||||
handleShift();
|
handleShift();
|
||||||
}
|
}
|
||||||
} else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) {
|
} else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) {
|
||||||
mSymbolKeyState.onPress();
|
switcher.onPressSymbol();
|
||||||
changeKeyboardMode();
|
changeKeyboardMode();
|
||||||
} else {
|
} else {
|
||||||
mShiftKeyState.onOtherKeyPressed();
|
mShiftKeyState.onOtherKeyPressed();
|
||||||
mSymbolKeyState.onOtherKeyPressed();
|
switcher.onOtherKeyPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2352,10 +2351,10 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
mShiftKeyState.onRelease();
|
mShiftKeyState.onRelease();
|
||||||
} else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) {
|
} else if (distinctMultiTouch && primaryCode == BaseKeyboard.KEYCODE_MODE_CHANGE) {
|
||||||
if (mSymbolKeyState.isMomentary()) {
|
if (switcher.isSymbolMomentary()) {
|
||||||
changeKeyboardMode();
|
changeKeyboardMode();
|
||||||
}
|
}
|
||||||
mSymbolKeyState.onRelease();
|
switcher.onReleaseSymbol();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue