Update other alt keys' graphics
Change-Id: I12699907a514f5fc2e110a0a711fb91c14a8756fmain
parent
b4fbbe57f5
commit
faad353fea
|
@ -125,6 +125,7 @@ public class Keyboard {
|
|||
/** Array of keys and icons in this keyboard */
|
||||
public final Key[] mKeys;
|
||||
public final Key[] mShiftKeys;
|
||||
public final Key[] mAltCodeKeysWhileTyping;
|
||||
public final KeyboardIconsSet mIconsSet;
|
||||
|
||||
private final HashMap<Integer, Key> mKeyCache = new HashMap<Integer, Key>();
|
||||
|
@ -148,6 +149,8 @@ public class Keyboard {
|
|||
|
||||
mKeys = params.mKeys.toArray(new Key[params.mKeys.size()]);
|
||||
mShiftKeys = params.mShiftKeys.toArray(new Key[params.mShiftKeys.size()]);
|
||||
mAltCodeKeysWhileTyping = params.mAltCodeKeysWhileTyping.toArray(
|
||||
new Key[params.mAltCodeKeysWhileTyping.size()]);
|
||||
mIconsSet = params.mIconsSet;
|
||||
mAdditionalProximityChars = params.mAdditionalProximityChars;
|
||||
|
||||
|
@ -224,6 +227,7 @@ public class Keyboard {
|
|||
|
||||
public final ArrayList<Key> mKeys = new ArrayList<Key>();
|
||||
public final ArrayList<Key> mShiftKeys = new ArrayList<Key>();
|
||||
public final ArrayList<Key> mAltCodeKeysWhileTyping = new ArrayList<Key>();
|
||||
public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet();
|
||||
// TODO: Should be in Key instead of Keyboard.Params?
|
||||
public final Map<Integer, List<Integer>> mAdditionalProximityChars =
|
||||
|
@ -305,6 +309,9 @@ public class Keyboard {
|
|||
if (key.mCode == Keyboard.CODE_SHIFT) {
|
||||
mShiftKeys.add(key);
|
||||
}
|
||||
if (key.altCodeWhileTyping()) {
|
||||
mAltCodeKeysWhileTyping.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
private int mMaxHeightCount = 0;
|
||||
|
|
|
@ -322,55 +322,74 @@ public class PointerTracker {
|
|||
|
||||
private void setReleasedKeyGraphics(Key key) {
|
||||
mDrawingProxy.dismissKeyPreview(this);
|
||||
if (key != null && key.isEnabled()) {
|
||||
key.onReleased();
|
||||
mDrawingProxy.invalidateKey(key);
|
||||
if (key == null || !key.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.isShift()) {
|
||||
for (final Key shiftKey : mKeyboard.mShiftKeys) {
|
||||
if (shiftKey != key) {
|
||||
shiftKey.onReleased();
|
||||
mDrawingProxy.invalidateKey(shiftKey);
|
||||
}
|
||||
updateReleaseKeyGraphics(key);
|
||||
|
||||
if (key.isShift()) {
|
||||
for (final Key shiftKey : mKeyboard.mShiftKeys) {
|
||||
if (shiftKey != key) {
|
||||
updateReleaseKeyGraphics(shiftKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key.altCodeWhileTyping()) {
|
||||
final Key altKey = mKeyboard.getKey(key.mAltCode);
|
||||
if (altKey != null) {
|
||||
altKey.onReleased();
|
||||
mDrawingProxy.invalidateKey(altKey);
|
||||
if (key.altCodeWhileTyping()) {
|
||||
final int altCode = key.mAltCode;
|
||||
final Key altKey = mKeyboard.getKey(altCode);
|
||||
if (altKey != null) {
|
||||
updateReleaseKeyGraphics(altKey);
|
||||
}
|
||||
for (final Key k : mKeyboard.mAltCodeKeysWhileTyping) {
|
||||
if (k != key && k.mAltCode == altCode) {
|
||||
updateReleaseKeyGraphics(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setPressedKeyGraphics(Key key) {
|
||||
if (key != null && key.isEnabled()) {
|
||||
if (!key.noKeyPreview()) {
|
||||
mDrawingProxy.showKeyPreview(this);
|
||||
}
|
||||
key.onPressed();
|
||||
mDrawingProxy.invalidateKey(key);
|
||||
if (key == null || !key.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.isShift()) {
|
||||
for (final Key shiftKey : mKeyboard.mShiftKeys) {
|
||||
if (shiftKey != key) {
|
||||
shiftKey.onPressed();
|
||||
mDrawingProxy.invalidateKey(shiftKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!key.noKeyPreview()) {
|
||||
mDrawingProxy.showKeyPreview(this);
|
||||
}
|
||||
updatePressKeyGraphics(key);
|
||||
|
||||
if (key.altCodeWhileTyping() && mTimerProxy.isTyping()) {
|
||||
final Key altKey = mKeyboard.getKey(key.mAltCode);
|
||||
if (altKey != null) {
|
||||
// TODO: Show altKey's preview.
|
||||
altKey.onPressed();
|
||||
mDrawingProxy.invalidateKey(altKey);
|
||||
if (key.isShift()) {
|
||||
for (final Key shiftKey : mKeyboard.mShiftKeys) {
|
||||
if (shiftKey != key) {
|
||||
updatePressKeyGraphics(shiftKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key.altCodeWhileTyping() && mTimerProxy.isTyping()) {
|
||||
final int altCode = key.mAltCode;
|
||||
final Key altKey = mKeyboard.getKey(altCode);
|
||||
if (altKey != null) {
|
||||
updatePressKeyGraphics(altKey);
|
||||
}
|
||||
for (final Key k : mKeyboard.mAltCodeKeysWhileTyping) {
|
||||
if (k != key && k.mAltCode == altCode) {
|
||||
updatePressKeyGraphics(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateReleaseKeyGraphics(Key key) {
|
||||
key.onReleased();
|
||||
mDrawingProxy.invalidateKey(key);
|
||||
}
|
||||
|
||||
private void updatePressKeyGraphics(Key key) {
|
||||
key.onPressed();
|
||||
mDrawingProxy.invalidateKey(key);
|
||||
}
|
||||
|
||||
public int getLastX() {
|
||||
|
|
Loading…
Reference in New Issue