本文整理了Java中android.view.MotionEvent.obtainNoHistory()
方法的一些代码示例,展示了MotionEvent.obtainNoHistory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MotionEvent.obtainNoHistory()
方法的具体详情如下:
包路径:android.view.MotionEvent
类名称:MotionEvent
方法名:obtainNoHistory
暂无
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
private MotionEvent obtainMotionEvent(MotionEvent base, int action) {
MotionEvent ev = MotionEvent.obtainNoHistory(base);
ev.setAction(action);
return ev;
}
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
case MotionEvent.ACTION_DOWN:
mInitialPoint = new PointF(ev.getX(), ev.getY());
mPendingDownMotionEvent = MotionEvent.obtainNoHistory(ev);
mDownMotionEventPended = true;
mIntercepting = mTouchInterceptionListener.shouldInterceptTouchEvent(ev, false, 0, 0);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
Rect childRect = new Rect();
childView.getHitRect(childRect);
MotionEvent event = MotionEvent.obtainNoHistory(ev);
if (!childRect.contains((int) event.getX(), (int) event.getY())) {
continue;
for (MotionEvent pe : pendingEvents) {
if (pe != null) {
MotionEvent peAdjusted = MotionEvent.obtainNoHistory(pe);
peAdjusted.offsetLocation(offsetX, offsetY);
consumed |= childView.dispatchTouchEvent(peAdjusted);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
mBeganFromDownMotionEvent = true;
MotionEvent event = MotionEvent.obtainNoHistory(mPendingDownMotionEvent);
event.setLocation(ev.getX(), ev.getY());
mTouchInterceptionListener.onDownMotionEvent(event);
if (mDownMotionEventPended) {
mDownMotionEventPended = false;
MotionEvent event = MotionEvent.obtainNoHistory(mPendingDownMotionEvent);
event.setLocation(ev.getX(), ev.getY());
duplicateTouchEventForChildren(ev, event);
if (mDownMotionEventPended) {
mDownMotionEventPended = false;
MotionEvent event = MotionEvent.obtainNoHistory(mPendingDownMotionEvent);
event.setLocation(ev.getX(), ev.getY());
duplicateTouchEventForChildren(ev, event);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
mPrevMoveEvent = MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
offsetY += v.getTop() - v.getScrollY();
final MotionEvent event = MotionEvent.obtainNoHistory(ev);
event.offsetLocation(offsetX, offsetY);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
mPrevMoveEvent = MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
offsetY += v.getTop() - v.getScrollY();
final MotionEvent event = MotionEvent.obtainNoHistory(ev);
event.offsetLocation(offsetX, offsetY);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
mPrevMoveEvent = MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
offsetY += v.getTop() - v.getScrollY();
final MotionEvent event = MotionEvent.obtainNoHistory(ev);
event.offsetLocation(offsetX, offsetY);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
mPrevMoveEvent = MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
offsetY += v.getTop() - v.getScrollY();
final MotionEvent event = MotionEvent.obtainNoHistory(ev);
event.offsetLocation(offsetX, offsetY);
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
mPrevMoveEvent = MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
final MotionEvent event = MotionEvent.obtainNoHistory(ev);
event.offsetLocation(offsetX, offsetY);
代码示例来源:origin: rey5137/material
/**
* Handled forwarded motion events and determines when to stop forwarding.
*
* @param srcEvent motion event in source view coordinates
* @return true to continue forwarding motion events, false to cancel
*/
private boolean onTouchForwarded(MotionEvent srcEvent) {
final View src = mSrc;
final ListPopupWindow popup = getPopup();
if (popup == null || !popup.isShowing()) {
return false;
}
final DropDownListView dst = popup.mDropDownList;
if (dst == null || !dst.isShown()) {
return false;
}
// Convert event to destination-local coordinates.
final MotionEvent dstEvent = MotionEvent.obtainNoHistory(srcEvent);
toGlobalMotionEvent(src, dstEvent);
toLocalMotionEvent(dst, dstEvent);
// Forward converted event to destination view, then recycle it.
final boolean handled = dst.onForwardedEvent(dstEvent, mActivePointerId);
dstEvent.recycle();
// Always cancel forwarding when the touch stream ends.
final int action = MotionEventCompat.getActionMasked(srcEvent);
final boolean keepForwarding = action != MotionEvent.ACTION_UP
&& action != MotionEvent.ACTION_CANCEL;
return handled && keepForwarding;
}
代码示例来源:origin: robolectric/robolectric
assertThat(motionEvent2).historicalEventTime(0).isEqualTo(eventTime);
motionEventDynamic = MotionEvent.obtainNoHistory(motionEvent2);
代码示例来源:origin: mapsforge/mapsforge
private MotionEvent rotateEvent(final MotionEvent event, float degrees, float px, float py) {
if (degrees == 0)
return event;
matrix.setRotate(degrees, px, py);
final MotionEvent rotatedEvent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
rotatedEvent = MotionEvent.obtain(event);
rotatedEvent.transform(matrix);
} else {
rotatedEvent = MotionEvent.obtainNoHistory(event);
points[0] = event.getX();
points[1] = event.getY();
matrix.mapPoints(points);
rotatedEvent.setLocation(points[0], points[1]);
}
return rotatedEvent;
}
内容来源于网络,如有侵权,请联系作者删除!