diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 777a79520..e7a9d8513 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -79,8 +79,7 @@ public abstract class KeyDetector { * * @return Allocates and returns an array that can hold all key indices returned by * {@link #getKeyIndexAndNearbyCodes} method. All elements in the returned array are - * initialized by {@link com.android.inputmethod.latin.LatinKeyboardView.NOT_A_KEY} - * value. + * initialized by {@link #NOT_A_KEY} value. */ public int[] newCodeArray() { int[] codes = new int[getMaxNearbyKeys()]; diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardActionListener.java b/java/src/com/android/inputmethod/keyboard/KeyboardActionListener.java index 00f3a5153..734a55a79 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardActionListener.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardActionListener.java @@ -19,64 +19,56 @@ package com.android.inputmethod.keyboard; public interface KeyboardActionListener { /** - * Called when the user presses a key. This is sent before the - * {@link #onCodeInput} is called. For keys that repeat, this is only - * called once. + * Called when the user presses a key. This is sent before the {@link #onCodeInput} is called. + * 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. + * @param primaryCode the unicode of the key being pressed. If the touch is not on a valid key, + * the value will be zero. */ - void onPress(int primaryCode); + public void onPress(int primaryCode); /** - * Called when the user releases a key. This is sent after the - * {@link #onCodeInput} is called. For keys that repeat, this is only - * called once. + * Called when the user releases a key. This is sent after the {@link #onCodeInput} is called. + * For keys that repeat, this is only called once. * - * @param primaryCode - * the code of the key that was released + * @param primaryCode the code of the key that was released */ - void onRelease(int primaryCode); + public void onRelease(int primaryCode); /** * Send a key code to the listener. * - * @param primaryCode - * this is the code of the key that was pressed - * @param keyCodes - * the codes for all the possible alternative keys with - * the primary code being the first. If the primary key - * code is a single character such as an alphabet or - * number or symbol, the alternatives will include other - * characters that may be on the same key or adjacent - * keys. These codes are useful to correct for - * accidental presses of a key adjacent to the intended - * key. - * @param x - * x-coordinate pixel of touched event. If {@link #onCodeInput} is not called by - * onTouchEvent, the value should be NOT_A_TOUCH_COORDINATE. - * @param y - * y-coordinate pixel of touched event. If {@link #onCodeInput} is not called by - * onTouchEvent, the value should be NOT_A_TOUCH_COORDINATE. + * @param primaryCode this is the code of the key that was pressed + * @param keyCodes the codes for all the possible alternative keys with the primary code being + * the first. If the primary key code is a single character such as an alphabet or + * number or symbol, the alternatives will include other characters that may be on + * the same key or adjacent keys. These codes are useful to correct for accidental + * presses of a key adjacent to the intended key. + * @param x x-coordinate pixel of touched event. If {@link #onCodeInput} is not called by + * {@link PointerTracker#onTouchEvent} or so, the value should be + * {@link #NOT_A_TOUCH_COORDINATE}. + * @param y y-coordinate pixel of touched event. If {@link #onCodeInput} is not called by + * {@link PointerTracker#onTouchEvent} or so, the value should be + * {@link #NOT_A_TOUCH_COORDINATE}. */ - void onCodeInput(int primaryCode, int[] keyCodes, int x, int y); + public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y); + + public static final int NOT_A_TOUCH_COORDINATE = -1; /** * Sends a sequence of characters to the listener. * - * @param text - * the sequence of characters to be displayed. + * @param text the sequence of characters to be displayed. */ - void onTextInput(CharSequence text); + public void onTextInput(CharSequence text); /** * Called when user released a finger outside any key. */ - void onCancelInput(); + public void onCancelInput(); /** * Called when the user quickly moves the finger from up to down. */ - void onSwipeDown(); + public void onSwipeDown(); } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index e0835d7ed..b259e0c03 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -79,8 +79,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { public static final int COLOR_SCHEME_WHITE = 0; public static final int COLOR_SCHEME_BLACK = 1; - public static final int NOT_A_TOUCH_COORDINATE = -1; - // Timing constants private final int mKeyRepeatInterval; diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index cb3b430d5..6b052c7e7 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -95,8 +95,8 @@ public class LatinKeyboardView extends KeyboardView { private boolean invokeOnKey(int primaryCode) { getOnKeyboardActionListener().onCodeInput(primaryCode, null, - KeyboardView.NOT_A_TOUCH_COORDINATE, - KeyboardView.NOT_A_TOUCH_COORDINATE); + KeyboardActionListener.NOT_A_TOUCH_COORDINATE, + KeyboardActionListener.NOT_A_TOUCH_COORDINATE); return true; } diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index e785eb76f..28c5d73f0 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1583,8 +1583,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen LatinImeLogger.logOnManualSuggestion( "", suggestion.toString(), index, suggestions.mWords); final char primaryCode = suggestion.charAt(0); - onCodeInput(primaryCode, new int[]{primaryCode}, KeyboardView.NOT_A_TOUCH_COORDINATE, - KeyboardView.NOT_A_TOUCH_COORDINATE); + onCodeInput(primaryCode, new int[] { primaryCode }, + KeyboardActionListener.NOT_A_TOUCH_COORDINATE, + KeyboardActionListener.NOT_A_TOUCH_COORDINATE); if (ic != null) { ic.endBatchEdit(); }