Move NOT_A_TOUCH_COORDINATE constant to KeyboardActionListener

Change-Id: Iff3fde48682a7c56201fc9eb3640755e0090d0ee
main
Tadashi G. Takaoka 2010-12-31 01:35:24 +09:00
parent 611044ab30
commit a96574fdd5
5 changed files with 34 additions and 44 deletions

View File

@ -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()];

View File

@ -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();
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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();
}