summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/KeyboardView.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/inputmethodservice/KeyboardView.java')
-rwxr-xr-xcore/java/android/inputmethodservice/KeyboardView.java22
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