diff options
author | 2010-09-01 23:18:39 +0900 | |
---|---|---|
committer | 2010-09-02 01:53:26 +0900 | |
commit | 2085d43daf44752deae1b6b00a14cb0f517d69cb (patch) | |
tree | d24337e187be77f21c431aee76c4f05aa6f454a3 /java/src/com/android/inputmethod/latin/ProximityKeyDetector.java | |
parent | 681b102a492b7d5301c1ca87985b4c391eb5eb14 (diff) | |
download | latinime-2085d43daf44752deae1b6b00a14cb0f517d69cb.tar.gz latinime-2085d43daf44752deae1b6b00a14cb0f517d69cb.tar.xz latinime-2085d43daf44752deae1b6b00a14cb0f517d69cb.zip |
Make abstract KeyDetector class
The KeyDetector abstracts key detection algorithm. The
ProximityKeyDetector is one of its concrete implementations. Another
one that might be called XAxisKeyDetector will follow to realize the
pop-up mini-keyboard behavior described in bug#2959169.
Bug: 2959169
Change-Id: Idd3fc53282e6b721ec7a4ce500af8aba21ce07a3
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ProximityKeyDetector.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/ProximityKeyDetector.java | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java index eae2d7f08..6ee005510 100644 --- a/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java +++ b/java/src/com/android/inputmethod/latin/ProximityKeyDetector.java @@ -16,48 +16,24 @@ package com.android.inputmethod.latin; -import android.inputmethodservice.Keyboard; import android.inputmethodservice.Keyboard.Key; import java.util.Arrays; -class ProximityKeyDetector { +class ProximityKeyDetector extends KeyDetector { private static final int MAX_NEARBY_KEYS = 12; - private Keyboard mKeyboard; - private Key[] mKeys; - - private boolean mProximityCorrectOn; - private int mProximityThresholdSquare; - // working area private int[] mDistances = new int[MAX_NEARBY_KEYS]; - public void setKeyboard(Keyboard keyboard, Key[] keys) { - if (keyboard == null || keys == null) - throw new NullPointerException(); - mKeyboard = keyboard; - mKeys = keys; - } - - public void setProximityCorrectionEnabled(boolean enabled) { - mProximityCorrectOn = enabled; - } - - public boolean isProximityCorrectionEnabled() { - return mProximityCorrectOn; - } - - public void setProximityThreshold(int threshold) { - mProximityThresholdSquare = threshold * threshold; - } - + @Override public int[] newCodeArray() { int[] codes = new int[MAX_NEARBY_KEYS]; Arrays.fill(codes, LatinKeyboardBaseView.NOT_A_KEY); return codes; } + @Override public int getKeyIndexAndNearbyCodes(int x, int y, int[] allKeys) { final Key[] keys = mKeys; if (keys == null) |