am 8ba87982: Merge "Consolidate forwardTouchEvent with dispatchTouchEvent"
* commit '8ba8798290388ed740f0ca4f01e74b11847b6d44': Consolidate forwardTouchEvent with dispatchTouchEventmain
commit
9f87373ea7
|
@ -33,11 +33,11 @@ public final class InputView extends LinearLayout {
|
||||||
private final Rect mEventForwardingRect = new Rect();
|
private final Rect mEventForwardingRect = new Rect();
|
||||||
private final Rect mEventReceivingRect = new Rect();
|
private final Rect mEventReceivingRect = new Rect();
|
||||||
|
|
||||||
public InputView(Context context, AttributeSet attrs) {
|
public InputView(final Context context, final AttributeSet attrs) {
|
||||||
super(context, attrs, 0);
|
super(context, attrs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyboardGeometry(int keyboardTopPadding) {
|
public void setKeyboardGeometry(final int keyboardTopPadding) {
|
||||||
mKeyboardTopPadding = keyboardTopPadding;
|
mKeyboardTopPadding = keyboardTopPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,18 +48,14 @@ public final class InputView extends LinearLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchTouchEvent(MotionEvent me) {
|
public boolean dispatchTouchEvent(final MotionEvent me) {
|
||||||
if (mSuggestionStripView.getVisibility() == VISIBLE
|
if (mSuggestionStripView.getVisibility() != VISIBLE
|
||||||
&& mKeyboardView.getVisibility() == VISIBLE
|
|| mKeyboardView.getVisibility() != VISIBLE) {
|
||||||
&& forwardTouchEvent(me)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.dispatchTouchEvent(me);
|
return super.dispatchTouchEvent(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The touch events that hit the top padding of keyboard should be forwarded to
|
// The touch events that hit the top padding of keyboard should be forwarded to
|
||||||
// {@link SuggestionStripView}.
|
// {@link SuggestionStripView}.
|
||||||
private boolean forwardTouchEvent(MotionEvent me) {
|
|
||||||
final Rect rect = mInputViewRect;
|
final Rect rect = mInputViewRect;
|
||||||
this.getGlobalVisibleRect(rect);
|
this.getGlobalVisibleRect(rect);
|
||||||
final int x = (int)me.getX() + rect.left;
|
final int x = (int)me.getX() + rect.left;
|
||||||
|
@ -68,7 +64,7 @@ public final class InputView extends LinearLayout {
|
||||||
final Rect forwardingRect = mEventForwardingRect;
|
final Rect forwardingRect = mEventForwardingRect;
|
||||||
mKeyboardView.getGlobalVisibleRect(forwardingRect);
|
mKeyboardView.getGlobalVisibleRect(forwardingRect);
|
||||||
if (!mIsForwardingEvent && !forwardingRect.contains(x, y)) {
|
if (!mIsForwardingEvent && !forwardingRect.contains(x, y)) {
|
||||||
return false;
|
return super.dispatchTouchEvent(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int forwardingLimitY = forwardingRect.top + mKeyboardTopPadding;
|
final int forwardingLimitY = forwardingRect.top + mKeyboardTopPadding;
|
||||||
|
@ -93,7 +89,7 @@ public final class InputView extends LinearLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sendToTarget) {
|
if (!sendToTarget) {
|
||||||
return false;
|
return super.dispatchTouchEvent(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Rect receivingRect = mEventReceivingRect;
|
final Rect receivingRect = mEventReceivingRect;
|
||||||
|
|
Loading…
Reference in New Issue