Merge "Add KeyboardActionListener.Adapter"

main
Tadashi G. Takaoka 2011-08-29 03:19:04 -07:00 committed by Android (Google) Code Review
commit a9311741b8
3 changed files with 21 additions and 17 deletions

View File

@ -76,4 +76,21 @@ public interface KeyboardActionListener {
* @return true if the request has been consumed, false otherwise.
*/
public boolean onCustomRequest(int requestCode);
public static class Adapter implements KeyboardActionListener {
@Override
public void onPress(int primaryCode, boolean withSliding) {}
@Override
public void onRelease(int primaryCode, boolean withSliding) {}
@Override
public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) {}
@Override
public void onTextInput(CharSequence text) {}
@Override
public void onCancelInput() {}
@Override
public boolean onCustomRequest(int requestCode) {
return false;
}
}
}

View File

@ -139,20 +139,8 @@ public class PointerTracker {
private boolean mIgnoreModifierKey;
// Empty {@link KeyboardActionListener}
private static final KeyboardActionListener EMPTY_LISTENER = new KeyboardActionListener() {
@Override
public void onPress(int primaryCode, boolean withSliding) {}
@Override
public void onRelease(int primaryCode, boolean withSliding) {}
@Override
public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) {}
@Override
public void onTextInput(CharSequence text) {}
@Override
public void onCancelInput() {}
@Override
public boolean onCustomRequest(int requestCode) { return false; }
};
private static final KeyboardActionListener EMPTY_LISTENER =
new KeyboardActionListener.Adapter();
public static void init(boolean hasDistinctMultitouch, Context context) {
if (hasDistinctMultitouch) {

View File

@ -101,7 +101,8 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
public void cancelKeyTimers() {}
};
private final KeyboardActionListener mMiniKeyboardListener = new KeyboardActionListener() {
private final KeyboardActionListener mMiniKeyboardListener =
new KeyboardActionListener.Adapter() {
@Override
public void onCodeInput(int primaryCode, int[] keyCodes, int x, int y) {
mListener.onCodeInput(primaryCode, keyCodes, x, y);
@ -125,8 +126,6 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel {
public void onRelease(int primaryCode, boolean withSliding) {
mListener.onRelease(primaryCode, withSliding);
}
@Override
public boolean onCustomRequest(int requestCode) { return false; }
};
public PopupMiniKeyboardView(Context context, AttributeSet attrs) {