aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2011-08-30 03:40:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-30 03:40:37 -0700
commit39cc80660517886c92f57f74fc787b3e2ee53546 (patch)
treea41b3ec604412992e12ce172a3d7f6576cbfa957 /java/src
parent392276d73dd6a1787afd3b859c213378e8e7bdb5 (diff)
parentc06d0ef01ddf286080fd421829a587741b1ebc1b (diff)
downloadlatinime-39cc80660517886c92f57f74fc787b3e2ee53546.tar.gz
latinime-39cc80660517886c92f57f74fc787b3e2ee53546.tar.xz
latinime-39cc80660517886c92f57f74fc787b3e2ee53546.zip
Merge "Cleanup keyboard related code a bit"
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java2
-rw-r--r--java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java15
3 files changed, 18 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
index 5fa9b8fc4..69cbcb154 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java
@@ -463,7 +463,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
mPopupPanelPointerTrackerId = tracker.mPointerId;
final Keyboard keyboard = getKeyboard();
- mPopupPanel.setShifted(keyboard.isShiftedOrShiftLocked());
+ popupPanel.setShifted(keyboard.isShiftedOrShiftLocked());
final int pointX = (mConfigShowMiniKeyboardAtTouchedPoint) ? tracker.getLastX()
: parentKey.mX + parentKey.mWidth / 2;
final int pointY = parentKey.mY - keyboard.mVerticalGap;
diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
index c4428dc60..7ace46cac 100644
--- a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java
@@ -197,8 +197,8 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
@Override
public void setShifted(boolean shifted) {
- final MiniKeyboard miniKeyboard = (MiniKeyboard)getKeyboard();
- if (miniKeyboard.setShifted(shifted)) {
+ final Keyboard keyboard = getKeyboard();
+ if (keyboard.setShifted(shifted)) {
invalidateAllKeys();
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
index 4ccaa72d2..980115200 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java
@@ -64,6 +64,15 @@ public class KeyboardParams {
public int mMostCommonKeyWidth = 0;
+ protected void clearKeys() {
+ mKeys.clear();
+ mShiftKeys.clear();
+ mShiftLockKeys.clear();
+ mShiftedIcons.clear();
+ mUnshiftedIcons.clear();
+ clearHistogram();
+ }
+
public void onAddKey(Key key) {
mKeys.add(key);
updateHistogram(key);
@@ -83,6 +92,12 @@ public class KeyboardParams {
private int mMaxCount = 0;
private final Map<Integer, Integer> mHistogram = new HashMap<Integer, Integer>();
+ private void clearHistogram() {
+ mMostCommonKeyWidth = 0;
+ mMaxCount = 0;
+ mHistogram.clear();
+ }
+
private void updateHistogram(Key key) {
final Integer width = key.mWidth + key.mHorizontalGap;
final int count = (mHistogram.containsKey(width) ? mHistogram.get(width) : 0) + 1;