am 07145a37: Fix automatic temporary upper case mode shift key graphics

* commit '07145a3706d7692806b9c53548795fa2dbf8f4f0':
  Fix automatic temporary upper case mode shift key graphics
main
Tadashi G. Takaoka 2011-12-26 06:44:34 -08:00 committed by Android Git Automerger
commit 33f4ea7ee6
2 changed files with 15 additions and 9 deletions

View File

@ -205,16 +205,21 @@ public class Keyboard {
return mShiftState.isShiftLocked();
}
private void setShiftKeyGraphics(boolean newShiftState) {
if (mShiftState.isShiftLocked()) {
return;
}
for (final Key key : mShiftKeys) {
final int attrId = newShiftState
? R.styleable.Keyboard_iconShiftKeyShifted
: R.styleable.Keyboard_iconShiftKey;
key.setIcon(mIconsSet.getIconByAttrId(attrId));
}
}
// TODO: Remove this method.
void setShifted(boolean newShiftState) {
if (!mShiftState.isShiftLocked()) {
for (final Key key : mShiftKeys) {
final int attrId = newShiftState
? R.styleable.Keyboard_iconShiftKeyShifted
: R.styleable.Keyboard_iconShiftKey;
key.setIcon(mIconsSet.getIconByAttrId(attrId));
}
}
setShiftKeyGraphics(newShiftState);
mShiftState.setShifted(newShiftState);
}
@ -225,6 +230,7 @@ public class Keyboard {
// TODO: Remove this method
void setAutomaticTemporaryUpperCase() {
setShiftKeyGraphics(true);
mShiftState.setAutomaticTemporaryUpperCase();
}

View File

@ -134,6 +134,7 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
if (mainKeyboardId.isPhoneKeyboard()) {
mState.onToggleAlphabetAndSymbols();
}
updateShiftState();
}
public void saveKeyboardState() {
@ -164,7 +165,6 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
mKeyboardView.updateSpacebar(0.0f,
mSubtypeSwitcher.needsToDisplayLanguage(keyboard.mId.mLocale));
mKeyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
updateShiftState();
final boolean localeChanged = (oldKeyboard == null)
|| !keyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged);