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 <animator
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:valueType="intType" android:valueType="intType"
android:duration="400" android:duration="70"
android:valueFrom="255" android:valueFrom="255"
android:valueTo="128" /> android:valueTo="128" />

View File

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

View File

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