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