Skip to content
Snippets Groups Projects
Commit b7a5a682 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Fix stale key drawing

Bug: 6509479
Change-Id: I49988ac951f6b37b14192ef1113a0d668a84f1a2
parent eca2912a
No related branches found
No related tags found
No related merge requests found
...@@ -197,6 +197,20 @@ public class Keyboard { ...@@ -197,6 +197,20 @@ public class Keyboard {
return null; return null;
} }
public boolean hasKey(Key aKey) {
if (mKeyCache.containsKey(aKey)) {
return true;
}
for (final Key key : mKeys) {
if (key == aKey) {
mKeyCache.put(key.mCode, key);
return true;
}
}
return false;
}
public static boolean isLetterCode(int code) { public static boolean isLetterCode(int code) {
return code >= MINIMUM_LETTER_CODE; return code >= MINIMUM_LETTER_CODE;
} }
......
...@@ -487,6 +487,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { ...@@ -487,6 +487,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
} else { } else {
// Draw invalidated keys. // Draw invalidated keys.
for (final Key key : mInvalidatedKeys) { for (final Key key : mInvalidatedKeys) {
if (!mKeyboard.hasKey(key)) {
continue;
}
final int x = key.mX + getPaddingLeft(); final int x = key.mX + getPaddingLeft();
final int y = key.mY + getPaddingTop(); final int y = key.mY + getPaddingTop();
mInvalidatedKeysRect.set(x, y, x + key.mWidth, y + key.mHeight); mInvalidatedKeysRect.set(x, y, x + key.mWidth, y + key.mHeight);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment