Disabled key should respond if it is in the altCodeWhileTyping state

Bug: 6128215
Change-Id: I81e9980f8ffa5c5eaba30676c8433f542645de1d
main
Tadashi G. Takaoka 2012-03-14 19:49:13 +09:00
parent 3848ca6729
commit 6bc9186457
3 changed files with 17 additions and 8 deletions

View File

@ -21,6 +21,6 @@
<animator
xmlns:android="http://schemas.android.com/apk/res/android"
android:valueType="intType"
android:duration="400"
android:duration="70"
android:valueFrom="255"
android:valueTo="128" />

View File

@ -908,7 +908,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
@Override
protected void onDrawKeyTopVisuals(Key key, Canvas canvas, Paint paint, KeyDrawParams params) {
if (key.altCodeWhileTyping()) {
if (key.altCodeWhileTyping() && key.isEnabled()) {
params.mAnimAlpha = mAltCodeKeyWhileTypingAnimAlpha;
}
if (key.mCode == Keyboard.CODE_SPACE) {

View File

@ -251,18 +251,19 @@ public class PointerTracker {
// primaryCode is different from {@link Key#mCode}.
private void callListenerOnCodeInput(Key key, int primaryCode, int x, int y) {
final boolean ignoreModifierKey = mIgnoreModifierKey && key.isModifier();
final boolean alterCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
final int code = alterCode ? key.mAltCode : primaryCode;
final boolean altersCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
final int code = altersCode ? key.mAltCode : primaryCode;
if (DEBUG_LISTENER) {
Log.d(TAG, "onCodeInput: " + Keyboard.printableCode(code) + " text=" + key.mOutputText
+ " x=" + x + " y=" + y
+ " ignoreModifier=" + ignoreModifierKey + " alterCode=" + alterCode
+ " ignoreModifier=" + ignoreModifierKey + " altersCode=" + altersCode
+ " enabled=" + key.isEnabled());
}
if (ignoreModifierKey) {
return;
}
if (key.isEnabled()) {
// Even if the key is disabled, it should respond if it is in the altCodeWhileTyping state.
if (key.isEnabled() || altersCode) {
if (code == Keyboard.CODE_OUTPUT_TEXT) {
mListener.onTextInput(key.mOutputText);
} else if (code != Keyboard.CODE_UNSPECIFIED) {
@ -322,10 +323,11 @@ public class PointerTracker {
private void setReleasedKeyGraphics(Key key) {
mDrawingProxy.dismissKeyPreview(this);
if (key == null || !key.isEnabled()) {
if (key == null) {
return;
}
// Even if the key is disabled, update the key release graphics just in case.
updateReleaseKeyGraphics(key);
if (key.isShift()) {
@ -351,7 +353,14 @@ public class PointerTracker {
}
private void setPressedKeyGraphics(Key key) {
if (key == null || !key.isEnabled()) {
if (key == null) {
return;
}
// Even if the key is disabled, it should respond if it is in the altCodeWhileTyping state.
final boolean altersCode = key.altCodeWhileTyping() && mTimerProxy.isTypingState();
final boolean needsToUpdateGraphics = key.isEnabled() || altersCode;
if (!needsToUpdateGraphics) {
return;
}