diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:33 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:33 -0800 |
| commit | 3dec7d563a2f3e1eb967ce2054a00b6620e3558c (patch) | |
| tree | aa3b0365c47cb3c1607c0dc76c8d32b4046fc287 /core/java/android/inputmethodservice/KeyboardView.java | |
| parent | 15ab3eae2ec3d73b3e8aa60b33ae41445bf83f4b (diff) | |
auto import from //depot/cupcake/@137055
Diffstat (limited to 'core/java/android/inputmethodservice/KeyboardView.java')
| -rwxr-xr-x | core/java/android/inputmethodservice/KeyboardView.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java index 886e68829e1d..c838779e5a3c 100755 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -74,7 +74,6 @@ public class KeyboardView extends View implements View.OnClickListener { * For keys that repeat, this is only called once. * @param primaryCode the unicode of the key being pressed. If the touch is not on a valid * key, the value will be zero. - * @hide Pending API Council approval */ void onPress(int primaryCode); @@ -82,7 +81,6 @@ public class KeyboardView extends View implements View.OnClickListener { * Called when the user releases a key. This is sent after the {@link #onKey} is called. * For keys that repeat, this is only called once. * @param primaryCode the code of the key that was released - * @hide Pending API Council approval */ void onRelease(int primaryCode); @@ -99,6 +97,12 @@ public class KeyboardView extends View implements View.OnClickListener { void onKey(int primaryCode, int[] keyCodes); /** + * Sends a sequence of characters to the listener. + * @param text the sequence of characters to be displayed. + */ + void onText(CharSequence text); + + /** * Called when the user quickly moves the finger from right to left. */ void swipeLeft(); @@ -394,6 +398,7 @@ public class KeyboardView extends View implements View.OnClickListener { requestLayout(); invalidate(); computeProximityThreshold(keyboard); + mMiniKeyboardCache.clear(); // Not really necessary to do every time, but will free up views } /** @@ -699,9 +704,7 @@ public class KeyboardView extends View implements View.OnClickListener { if (index != NOT_A_KEY && index < mKeys.length) { final Key key = mKeys[index]; if (key.text != null) { - for (int i = 0; i < key.text.length(); i++) { - mKeyboardActionListener.onKey(key.text.charAt(i), key.codes); - } + mKeyboardActionListener.onText(key.text); mKeyboardActionListener.onRelease(NOT_A_KEY); } else { int code = key.codes[0]; @@ -792,7 +795,7 @@ public class KeyboardView extends View implements View.OnClickListener { mPreviewText.setCompoundDrawables(null, null, null, null); mPreviewText.setText(getPreviewText(key)); if (key.label.length() > 1 && key.codes.length < 2) { - mPreviewText.setTextSize(mLabelTextSize); + mPreviewText.setTextSize(mKeyTextSize); mPreviewText.setTypeface(Typeface.DEFAULT_BOLD); } else { mPreviewText.setTextSize(mPreviewTextSizeLarge); @@ -896,6 +899,11 @@ public class KeyboardView extends View implements View.OnClickListener { dismissPopupKeyboard(); } + public void onText(CharSequence text) { + mKeyboardActionListener.onText(text); + dismissPopupKeyboard(); + } + public void swipeLeft() { } public void swipeRight() { } public void swipeUp() { } @@ -1102,6 +1110,8 @@ public class KeyboardView extends View implements View.OnClickListener { mHandler.removeMessages(MSG_SHOW_PREVIEW); dismissPopupKeyboard(); + + mMiniKeyboardCache.clear(); } @Override |
