am efe7abe0: am 12659d4c: Fix ALT key light behavior

Merge commit 'efe7abe03dce1779ce76e175d0fe9422d2f8eaad'

* commit 'efe7abe03dce1779ce76e175d0fe9422d2f8eaad':
  Fix ALT key light behavior
main
Tadashi G. Takaoka 2010-09-06 06:47:03 -07:00 committed by Android Git Automerger
commit 920c507cd3
3 changed files with 20 additions and 17 deletions

View File

@ -16,10 +16,6 @@
package com.android.inputmethod.latin;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
@ -27,6 +23,10 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.view.InflateException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
public static final int MODE_NONE = 0;
@ -197,8 +197,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
mHasVoice = enableVoice;
mVoiceOnPrimary = voiceOnPrimary;
setKeyboardMode(mMode, mImeOptions, mHasVoice,
mIsSymbols);
setKeyboardMode(mMode, mImeOptions, mHasVoice, mIsSymbols);
}
boolean hasVoiceButton(boolean isSymbols) {
@ -338,19 +337,23 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
void toggleShift() {
if (mCurrentId.equals(mSymbolsId)) {
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
symbolsKeyboard.setShifted(true);
mCurrentId = mSymbolsShiftedId;
mInputView.setKeyboard(symbolsShiftedKeyboard);
symbolsShiftedKeyboard.setShifted(true);
// Symbol shifted keyboard has an ALT key that has a caps lock style indicator. To
// enable the indicator, we need to call enableShiftLock() and setShiftLocked(true).
// Thus we can keep the ALT key's Key.on value true while LatinKey.onRelease() is
// called.
symbolsShiftedKeyboard.enableShiftLock();
symbolsShiftedKeyboard.setShiftLocked(true);
symbolsShiftedKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions);
} else if (mCurrentId.equals(mSymbolsShiftedId)) {
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
symbolsShiftedKeyboard.setShifted(false);
mCurrentId = mSymbolsId;
mInputView.setKeyboard(symbolsKeyboard);
// Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the
// indicator, we need to call enableShiftLock() and setShiftLocked(false).
symbolsKeyboard.enableShiftLock();
symbolsKeyboard.setShifted(false);
symbolsKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions);
}

View File

@ -16,9 +16,6 @@
package com.android.inputmethod.latin;
import java.util.List;
import java.util.Locale;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
@ -27,10 +24,10 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Paint.Align;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.inputmethodservice.Keyboard;
@ -39,6 +36,9 @@ import android.util.Log;
import android.view.ViewConfiguration;
import android.view.inputmethod.EditorInfo;
import java.util.List;
import java.util.Locale;
public class LatinKeyboard extends Keyboard {
private static final boolean DEBUG_PREFERRED_LETTER = false;
@ -128,7 +128,7 @@ public class LatinKeyboard extends Keyboard {
R.dimen.spacebar_vertical_correction);
mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty
|| xmlLayoutResId == R.xml.kbd_qwerty_black;
mSpaceKeyIndex = indexOf((int) ' ');
mSpaceKeyIndex = indexOf(' ');
}
public LatinKeyboard(Context context, int layoutTemplateResId,

View File

@ -131,7 +131,7 @@ public class LatinKeyboardView extends LatinKeyboardBaseView {
public boolean setShiftLocked(boolean shiftLocked) {
Keyboard keyboard = getKeyboard();
if (keyboard != null && keyboard instanceof LatinKeyboard) {
if (keyboard instanceof LatinKeyboard) {
((LatinKeyboard)keyboard).setShiftLocked(shiftLocked);
invalidateAllKeys();
return true;