aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/values-xlarge/dimens.xml3
-rw-r--r--java/res/values/dimens.xml1
-rw-r--r--java/res/values/styles.xml2
-rw-r--r--java/res/xml-xlarge/kbd_qwerty.xml218
-rw-r--r--java/res/xml-xlarge/kbd_symbols.xml160
-rw-r--r--java/res/xml-xlarge/kbd_symbols_shift.xml161
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java72
7 files changed, 581 insertions, 36 deletions
diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml
index 4e1c52877..37e6b9ef0 100644
--- a/java/res/values-xlarge/dimens.xml
+++ b/java/res/values-xlarge/dimens.xml
@@ -22,5 +22,6 @@
<dimen name="key_height">72dip</dimen>
<dimen name="candidate_strip_height">46dip</dimen>
<dimen name="spacebar_vertical_correction">0dip</dimen>
- <dimen name="key_text_size">35sp</dimen>
+ <dimen name="key_text_size">28sp</dimen>
+ <dimen name="keyboard_vertical_correction">0dip</dimen>
</resources>
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index b399af489..75efddf6c 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -31,4 +31,5 @@
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
<!-- key_height * 1.7 -->
<dimen name="mini_keyboard_slide_allowance">91.8dip</dimen>
+ <dimen name="keyboard_vertical_correction">-10dip</dimen>
</resources>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 5e239482f..f30c9f196 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -27,7 +27,7 @@
<item name="labelTextSize">14sp</item>
<item name="popupLayout">@layout/keyboard_popup</item>
<item name="keyHysteresisDistance">0.05in</item>
- <item name="verticalCorrection">-10dip</item>
+ <item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
<item name="shadowColor">#BB000000</item>
<item name="shadowRadius">2.75</item>
<item name="backgroundDimAmount">0.5</item>
diff --git a/java/res/xml-xlarge/kbd_qwerty.xml b/java/res/xml-xlarge/kbd_qwerty.xml
new file mode 100644
index 000000000..e710b34c7
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_qwerty.xml
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<Keyboard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+>
+ <Row>
+ <Key
+ android:codes="@integer/key_tab"
+ android:keyLabel="Tab"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="q"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_q"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="w"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_w" />
+ <Key
+ android:keyLabel="e"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_e" />
+ <Key
+ android:keyLabel="r"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_r" />
+ <Key
+ android:keyLabel="t"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_t" />
+ <Key
+ android:keyLabel="y"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_y" />
+ <Key
+ android:keyLabel="u"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_u" />
+ <Key
+ android:keyLabel="i"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_i" />
+ <Key
+ android:keyLabel="o"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_o" />
+ <Key
+ android:keyLabel="p"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_p" />
+ <Key
+ android:keyLabel="="
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="+" />
+ <Key
+ android:codes="@integer/key_delete"
+ android:keyIcon="@drawable/sym_keyboard_delete"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:keyWidth="10.5%p"
+ android:isModifier="true"
+ android:isRepeatable="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_symbol"
+ android:keyLabel="@string/label_symbol_key"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="a"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_a" />
+ <Key
+ android:keyLabel="s"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_s" />
+ <Key
+ android:keyLabel="d"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_d" />
+ <Key
+ android:keyLabel="f" />
+ <Key
+ android:keyLabel="g"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_g" />
+ <Key
+ android:keyLabel="h" />
+ <Key
+ android:keyLabel="j" />
+ <Key
+ android:keyLabel="k" />
+ <Key
+ android:keyLabel="l"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_l" />
+ <Key
+ android:keyLabel=";"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters=":" />
+ <Key
+ android:keyLabel="\'"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="&quot;" />
+ <Key
+ android:codes="@integer/key_return"
+ android:keyIcon="@drawable/sym_keyboard_return"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="z"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_z" />
+ <Key
+ android:keyLabel="x" />
+ <Key
+ android:keyLabel="c"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_c" />
+ <Key
+ android:keyLabel="v"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_v" />
+ <Key
+ android:keyLabel="b" />
+ <Key
+ android:keyLabel="n"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="@string/alternates_for_n" />
+ <Key
+ android:keyLabel="m" />
+ <Key
+ android:keyLabel=","
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="*" />
+ <Key
+ android:keyLabel="."
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="!" />
+ <Key
+ android:keyLabel="/"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="\?" />
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ </Row>
+ <Row
+ android:rowEdgeFlags="bottom"
+ >
+ <Key
+ android:keyLabel="&lt;"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="("
+ android:horizontalGap="16.25%p" />
+ <Key
+ android:keyLabel="&gt;"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters=")" />
+ <Key
+ android:codes="@integer/key_space"
+ android:keyIcon="@drawable/sym_keyboard_space"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:keyWidth="37.5%p"
+ android:isModifier="true" />
+ <Key
+ android:keyLabel="_"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="\@" />
+ <Key
+ android:keyLabel="-"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="#" />
+ </Row>
+</Keyboard>
diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml
new file mode 100644
index 000000000..9ac7716e8
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_symbols.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<Keyboard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+>
+ <Row
+ android:rowEdgeFlags="top"
+ >
+ <Key
+ android:codes="@integer/key_tab"
+ android:keyLabel="Tab"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="1" />
+ <Key
+ android:keyLabel="2" />
+ <Key
+ android:keyLabel="3" />
+ <Key
+ android:keyLabel="4" />
+ <Key
+ android:keyLabel="5" />
+ <Key
+ android:keyLabel="6" />
+ <Key
+ android:keyLabel="7" />
+ <Key
+ android:keyLabel="8" />
+ <Key
+ android:keyLabel="9" />
+ <Key
+ android:keyLabel="0" />
+ <Key
+ android:keyLabel="~" />
+ <Key
+ android:codes="@integer/key_delete"
+ android:keyIcon="@drawable/sym_keyboard_delete"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:keyWidth="10.5%p"
+ android:isModifier="true"
+ android:isRepeatable="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_symbol"
+ android:keyLabel="@string/label_symbol_key"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="\@" />
+ <Key
+ android:keyLabel="#" />
+ <Key
+ android:keyLabel="$" />
+ <Key
+ android:keyLabel="%" />
+ <Key
+ android:keyLabel="^" />
+ <Key
+ android:keyLabel="&amp;" />
+ <Key
+ android:keyLabel="*" />
+ <Key
+ android:keyLabel="-" />
+ <Key
+ android:keyLabel="+" />
+ <Key
+ android:keyLabel="(" />
+ <Key
+ android:keyLabel=")" />
+ <Key
+ android:codes="@integer/key_return"
+ android:keyIcon="@drawable/sym_keyboard_return"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="!" />
+ <Key
+ android:keyLabel="&quot;" />
+ <Key
+ android:keyLabel="\'" />
+ <Key
+ android:keyLabel=":" />
+ <Key
+ android:keyLabel=";" />
+ <Key
+ android:keyLabel="/" />
+ <Key
+ android:keyLabel="\\" />
+ <Key
+ android:keyLabel="," />
+ <Key
+ android:keyLabel="." />
+ <Key
+ android:keyLabel="\?" />
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ </Row>
+ <Row
+ android:rowEdgeFlags="bottom"
+ >
+ <Key
+ android:keyLabel="&lt;"
+ android:horizontalGap="16.25%p" />
+ <Key
+ android:keyLabel="&gt;" />
+ <Key
+ android:codes="@integer/key_space"
+ android:keyIcon="@drawable/sym_keyboard_space"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:keyWidth="37.5%p"
+ android:isModifier="true" />
+ <Key
+ android:keyLabel="[" />
+ <Key
+ android:keyLabel="]" />
+ </Row>
+</Keyboard>
diff --git a/java/res/xml-xlarge/kbd_symbols_shift.xml b/java/res/xml-xlarge/kbd_symbols_shift.xml
new file mode 100644
index 000000000..fbbf68ebd
--- /dev/null
+++ b/java/res/xml-xlarge/kbd_symbols_shift.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<Keyboard
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="7.5%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+>
+ <Row
+ android:rowEdgeFlags="top"
+ >
+ <Key
+ android:codes="@integer/key_tab"
+ android:keyLabel="Tab"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="∞" />
+ <Key
+ android:keyLabel="±" />
+ <Key
+ android:keyLabel="|" />
+ <Key
+ android:keyLabel="•" />
+ <Key
+ android:keyLabel="√" />
+ <Key
+ android:keyLabel="π" />
+ <Key
+ android:keyLabel="÷" />
+ <Key
+ android:keyLabel="×" />
+ <Key
+ android:keyLabel="±" />
+ <Key
+ android:keyLabel="∆" />
+ <Key
+ android:keyLabel="≈" />
+ <Key
+ android:codes="@integer/key_delete"
+ android:keyIcon="@drawable/sym_keyboard_delete"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:keyWidth="10.5%p"
+ android:isModifier="true"
+ android:isRepeatable="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_symbol"
+ android:keyLabel="@string/label_symbol_key"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="£" />
+ <Key
+ android:keyLabel="¢" />
+ <Key
+ android:keyLabel="¥" />
+ <Key
+ android:keyLabel="€" />
+ <Key
+ android:keyLabel="¼" />
+ <Key
+ android:keyLabel="½" />
+ <Key
+ android:keyLabel="¾" />
+ <Key
+ android:keyLabel="_" />
+ <Key
+ android:keyLabel="=" />
+ <Key
+ android:keyLabel="{" />
+ <Key
+ android:keyLabel="}" />
+ <Key
+ android:codes="@integer/key_return"
+ android:keyIcon="@drawable/sym_keyboard_return"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ android:keyWidth="8.75%p"
+ android:isModifier="true"
+ android:keyEdgeFlags="right" />
+ </Row>
+ <Row>
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ <Key
+ android:keyLabel="¡" />
+ <Key
+ android:keyLabel="°" />
+ <Key
+ android:keyLabel="©" />
+ <Key
+ android:keyLabel="®" />
+ <Key
+ android:keyLabel="¶" />
+ <Key
+ android:keyLabel="§" />
+ <Key
+ android:keyLabel="¤" />
+ <Key
+ android:keyLabel="¬" />
+ <Key
+ android:keyLabel="…" />
+ <Key
+ android:keyLabel="¿" />
+ <Key
+ android:codes="@integer/key_shift"
+ android:keyIcon="@drawable/sym_keyboard_shift"
+ android:iconPreview="@drawable/sym_keyboard_feedback_shift"
+ android:keyWidth="12.5%p"
+ android:isModifier="true"
+ android:isSticky="true"
+ android:keyEdgeFlags="left" />
+ </Row>
+ <Row
+ android:rowEdgeFlags="bottom"
+ >
+ <Key
+ android:keyLabel="≤"
+ android:horizontalGap="16.25%p" />
+ <Key
+ android:keyLabel="≥" />
+ <Key
+ android:codes="@integer/key_space"
+ android:keyIcon="@drawable/sym_keyboard_space"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:keyWidth="37.5%p"
+ android:isModifier="true" />
+ <Key
+ android:keyLabel="²" />
+ <Key
+ android:keyLabel="³" />
+ </Row>
+</Keyboard>
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index 14a503bc3..9e24ee322 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -36,6 +36,8 @@ import android.util.Log;
import android.view.ViewConfiguration;
import android.view.inputmethod.EditorInfo;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@@ -48,7 +50,7 @@ public class LatinKeyboard extends Keyboard {
private Drawable mShiftLockIcon;
private Drawable mShiftLockPreviewIcon;
- private Drawable mOldShiftIcon;
+ private final HashMap<Key, Drawable> mOldShiftIcons = new HashMap<Key, Drawable>();
private Drawable mSpaceIcon;
private Drawable mSpaceAutoCompletionIndicator;
private Drawable mSpacePreviewIcon;
@@ -58,7 +60,7 @@ public class LatinKeyboard extends Keyboard {
private Drawable m123MicPreviewIcon;
private final Drawable mButtonArrowLeftIcon;
private final Drawable mButtonArrowRightIcon;
- private Key mShiftKey;
+ private ArrayList<Key> mShiftKeys;
private Key mEnterKey;
private Key mF1Key;
private Key mSpaceKey;
@@ -170,6 +172,13 @@ public class LatinKeyboard extends Keyboard {
case LatinIME.KEYCODE_SPACE:
mSpaceKey = key;
break;
+ case KEYCODE_SHIFT:
+ // NOTE: This protected method is being called from the base class constructor before
+ // mShiftKeys gets initialized.
+ if (mShiftKeys == null)
+ mShiftKeys = new ArrayList<Key>();
+ mShiftKeys.add(key);
+ break;
case KEYCODE_MODE_CHANGE:
m123Key = key;
m123Label = key.label;
@@ -195,7 +204,7 @@ public class LatinKeyboard extends Keyboard {
return key;
}
- void setImeOptions(Resources res, int mode, int options) {
+ public void setImeOptions(Resources res, int mode, int options) {
if (mEnterKey != null) {
// Reset some of the rarely used attributes.
mEnterKey.popupCharacters = null;
@@ -253,61 +262,56 @@ public class LatinKeyboard extends Keyboard {
}
}
}
-
- void enableShiftLock() {
- int index = getShiftKeyIndex();
- if (index >= 0) {
- mShiftKey = getKeys().get(index);
- if (mShiftKey instanceof LatinKey) {
- ((LatinKey)mShiftKey).enableShiftLock();
+
+ public void enableShiftLock() {
+ for (final Key key : mShiftKeys) {
+ if (key instanceof LatinKey) {
+ ((LatinKey)key).enableShiftLock();
}
- mOldShiftIcon = mShiftKey.icon;
+ mOldShiftIcons.put(key, key.icon);
}
}
- void setShiftLocked(boolean shiftLocked) {
- if (mShiftKey != null) {
- if (shiftLocked) {
- mShiftKey.on = true;
- mShiftKey.icon = mShiftLockIcon;
- mShiftState = SHIFT_LOCKED;
- } else {
- mShiftKey.on = false;
- mShiftKey.icon = mShiftLockIcon;
- mShiftState = SHIFT_ON;
- }
+ public void setShiftLocked(boolean shiftLocked) {
+ for (final Key key : mShiftKeys) {
+ key.on = shiftLocked;
+ key.icon = mShiftLockIcon;
}
+ mShiftState = shiftLocked ? SHIFT_LOCKED : SHIFT_ON;
}
- boolean isShiftLocked() {
+ public boolean isShiftLocked() {
return mShiftState == SHIFT_LOCKED;
}
@Override
public boolean setShifted(boolean shiftState) {
boolean shiftChanged = false;
- if (mShiftKey != null) {
+ if (mShiftKeys.size() > 0) {
+ for (final Key key : mShiftKeys) {
+ if (shiftState == false) {
+ key.on = false;
+ key.icon = mOldShiftIcons.get(key);
+ } else if (mShiftState == SHIFT_OFF) {
+ key.icon = mShiftLockIcon;
+ }
+ }
if (shiftState == false) {
shiftChanged = mShiftState != SHIFT_OFF;
mShiftState = SHIFT_OFF;
- mShiftKey.on = false;
- mShiftKey.icon = mOldShiftIcon;
- } else {
- if (mShiftState == SHIFT_OFF) {
- shiftChanged = mShiftState == SHIFT_OFF;
- mShiftState = SHIFT_ON;
- mShiftKey.icon = mShiftLockIcon;
- }
+ } else if (mShiftState == SHIFT_OFF) {
+ shiftChanged = mShiftState == SHIFT_OFF;
+ mShiftState = SHIFT_ON;
}
+ return shiftChanged;
} else {
return super.setShifted(shiftState);
}
- return shiftChanged;
}
@Override
public boolean isShifted() {
- if (mShiftKey != null) {
+ if (mShiftKeys.size() > 0) {
return mShiftState != SHIFT_OFF;
} else {
return super.isShifted();