mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
More processTouchEvent from LatinKeyboardView to PointerTracker
Bug: 5241105 Change-Id: I8a5d15f43e2c9f294e78127eda68b0f85da5ad15
This commit is contained in:
parent
ea0c567f86
commit
8ac6d505b7
@ -552,7 +552,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||||||
mOldKeyIndex = tracker.getKeyIndexOn(lastX, lastY);
|
mOldKeyIndex = tracker.getKeyIndexOn(lastX, lastY);
|
||||||
tracker.onUpEvent(lastX, lastY, eventTime);
|
tracker.onUpEvent(lastX, lastY, eventTime);
|
||||||
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
||||||
processMotionEvent(tracker, action, x, y, eventTime, this);
|
tracker.processMotionEvent(action, x, y, eventTime, this);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Unknown touch panel behavior: pointer count is " + pointerCount
|
Log.w(TAG, "Unknown touch panel behavior: pointer count is " + pointerCount
|
||||||
+ " (old " + oldPointerCount + ")");
|
+ " (old " + oldPointerCount + ")");
|
||||||
@ -575,32 +575,12 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
|||||||
tracker.onMoveEvent(px, py, eventTime);
|
tracker.onMoveEvent(px, py, eventTime);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
processMotionEvent(getPointerTracker(id), action, x, y, eventTime, this);
|
getPointerTracker(id).processMotionEvent(action, x, y, eventTime, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processMotionEvent(PointerTracker tracker, int action, int x, int y,
|
|
||||||
long eventTime, PointerTracker.KeyEventHandler handler) {
|
|
||||||
switch (action) {
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
tracker.onDownEvent(x, y, eventTime, handler);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
|
||||||
tracker.onUpEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
tracker.onMoveEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
|
||||||
tracker.onCancelEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closing() {
|
public void closing() {
|
||||||
super.closing();
|
super.closing();
|
||||||
|
@ -19,6 +19,7 @@ package com.android.inputmethod.keyboard;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.internal.PointerTrackerQueue;
|
import com.android.inputmethod.keyboard.internal.PointerTrackerQueue;
|
||||||
@ -398,6 +399,26 @@ public class PointerTracker {
|
|||||||
return onMoveKeyInternal(x, y);
|
return onMoveKeyInternal(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void processMotionEvent(int action, int x, int y, long eventTime,
|
||||||
|
KeyEventHandler handler) {
|
||||||
|
switch (action) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
|
onDownEvent(x, y, eventTime, handler);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
|
onUpEvent(x, y, eventTime);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
onMoveEvent(x, y, eventTime);
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_CANCEL:
|
||||||
|
onCancelEvent(x, y, eventTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onDownEvent(int x, int y, long eventTime, KeyEventHandler handler) {
|
public void onDownEvent(int x, int y, long eventTime, KeyEventHandler handler) {
|
||||||
if (DEBUG_EVENT)
|
if (DEBUG_EVENT)
|
||||||
printTouchEvent("onDownEvent:", x, y, eventTime);
|
printTouchEvent("onDownEvent:", x, y, eventTime);
|
||||||
|
@ -762,29 +762,19 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
|||||||
if (!mMoreSuggestionsWindow.isShowing()) {
|
if (!mMoreSuggestionsWindow.isShowing()) {
|
||||||
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 long eventTime = me.getEventTime();
|
||||||
final int index = me.getActionIndex();
|
final int index = me.getActionIndex();
|
||||||
final int id = me.getPointerId(index);
|
final int id = me.getPointerId(index);
|
||||||
final PointerTracker tracker = PointerTracker.getPointerTracker(id, mMoreSuggestionsView);
|
final PointerTracker tracker = PointerTracker.getPointerTracker(id, moreKeysPanel);
|
||||||
final int x = mMoreSuggestionsView.translateX((int)me.getX(index));
|
final int x = (int)me.getX(index);
|
||||||
final int y = mMoreSuggestionsView.translateY((int)me.getY(index));
|
final int y = (int)me.getY(index);
|
||||||
switch (action) {
|
final int translatedX = moreKeysPanel.translateX(x);
|
||||||
case MotionEvent.ACTION_DOWN:
|
final int translatedY = moreKeysPanel.translateY(y);
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
|
||||||
tracker.onDownEvent(x, y, eventTime, mMoreSuggestionsView);
|
tracker.processMotionEvent(action, translatedX, translatedY, eventTime, moreKeysPanel);
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
|
||||||
tracker.onUpEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
tracker.onMoveEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_CANCEL:
|
|
||||||
tracker.onCancelEvent(x, y, eventTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user