aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java25
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java10
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboardView.java2
3 files changed, 20 insertions, 17 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index 3fb74b238..284b29305 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -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);
}
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index c7ca67727..caae92363 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -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,
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
index 71ca8b81a..4295427e3 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
@@ -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;