Merge "Remove processMotionEvent from MoreKeysKeyboardView"

main
Tadashi G. Takaoka 2013-08-08 08:23:22 +00:00 committed by Android (Google) Code Review
commit 96b444d429
4 changed files with 8 additions and 19 deletions

View File

@ -974,9 +974,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
// {@link KeyboardView#showKeyPreview(PointerTracker)}. // {@link KeyboardView#showKeyPreview(PointerTracker)}.
final int pointY = key.mY + mKeyPreviewDrawParams.mPreviewVisibleOffset; final int pointY = key.mY + mKeyPreviewDrawParams.mPreviewVisibleOffset;
moreKeysPanel.showMoreKeysPanel(this, this, pointX, pointY, mKeyboardActionListener); moreKeysPanel.showMoreKeysPanel(this, this, pointX, pointY, mKeyboardActionListener);
final int translatedX = moreKeysPanel.translateX(CoordinateUtils.x(lastCoords)); tracker.onShowMoreKeysPanel(moreKeysPanel);
final int translatedY = moreKeysPanel.translateY(CoordinateUtils.y(lastCoords));
tracker.onShowMoreKeysPanel(translatedX, translatedY, moreKeysPanel);
} }
public boolean isInSlidingKeyInput() { public boolean isInSlidingKeyInput() {

View File

@ -198,12 +198,6 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
final int x = (int)me.getX(index); final int x = (int)me.getX(index);
final int y = (int)me.getY(index); final int y = (int)me.getY(index);
final int pointerId = me.getPointerId(index); final int pointerId = me.getPointerId(index);
processMotionEvent(action, x, y, pointerId, eventTime);
return true;
}
public void processMotionEvent(final int action, final int x, final int y,
final int pointerId, final long eventTime) {
switch (action) { switch (action) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_DOWN:
@ -217,6 +211,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
onMoveEvent(x, y, pointerId, eventTime); onMoveEvent(x, y, pointerId, eventTime);
break; break;
} }
return true;
} }
@Override @Override

View File

@ -1282,12 +1282,12 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
} }
} }
public void onShowMoreKeysPanel(final int translatedX, final int translatedY, public void onShowMoreKeysPanel(final MoreKeysPanel panel) {
final MoreKeysPanel panel) {
setReleasedKeyGraphics(mCurrentKey); setReleasedKeyGraphics(mCurrentKey);
final long eventTime = SystemClock.uptimeMillis(); final int translatedX = panel.translateX(mLastX);
final int translatedY = panel.translateY(mLastY);
panel.onDownEvent(translatedX, translatedY, mPointerId, SystemClock.uptimeMillis());
mMoreKeysPanel = panel; mMoreKeysPanel = panel;
mMoreKeysPanel.onDownEvent(translatedX, translatedY, mPointerId, eventTime);
} }
@Override @Override

View File

@ -270,15 +270,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
return super.dispatchTouchEvent(me); return super.dispatchTouchEvent(me);
} }
final MoreKeysPanel moreKeysPanel = mMoreSuggestionsView;
final int action = me.getAction(); final int action = me.getAction();
final long eventTime = me.getEventTime();
final int index = me.getActionIndex(); final int index = me.getActionIndex();
final int id = me.getPointerId(index);
final int x = (int)me.getX(index); final int x = (int)me.getX(index);
final int y = (int)me.getY(index); final int y = (int)me.getY(index);
final int translatedX = moreKeysPanel.translateX(x);
final int translatedY = moreKeysPanel.translateY(y);
if (mMoreSuggestionsMode == MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING) { if (mMoreSuggestionsMode == MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING) {
if (Math.abs(x - mOriginX) >= mMoreSuggestionsModalTolerance if (Math.abs(x - mOriginX) >= mMoreSuggestionsModalTolerance
@ -295,7 +290,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
} }
// MORE_SUGGESTIONS_IN_SLIDING_MODE // MORE_SUGGESTIONS_IN_SLIDING_MODE
mMoreSuggestionsView.processMotionEvent(action, translatedX, translatedY, id, eventTime); me.setLocation(mMoreSuggestionsView.translateX(x), mMoreSuggestionsView.translateY(y));
mMoreSuggestionsView.onTouchEvent(me);
return true; return true;
} }