本文整理汇总了C#中android.getActionMasked方法的典型用法代码示例。如果您正苦于以下问题:C# android.getActionMasked方法的具体用法?C# android.getActionMasked怎么用?C# android.getActionMasked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.getActionMasked方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onTouchEvent
public virtual bool onTouchEvent(android.view.MotionEvent @event)
{
if (mInputEventConsistencyVerifier != null)
{
mInputEventConsistencyVerifier.onTouchEvent(@event, 0);
}
int action = @event.getActionMasked();
if (action == android.view.MotionEvent.ACTION_DOWN)
{
reset();
}
// Start fresh
bool handled = true;
if (mInvalidGesture)
{
handled = false;
}
else
{
if (!mGestureInProgress)
{
switch (action)
{
case android.view.MotionEvent.ACTION_DOWN:
{
mActiveId0 = @event.getPointerId(0);
mActive0MostRecent = true;
break;
}
case android.view.MotionEvent.ACTION_UP:
{
reset();
break;
}
case android.view.MotionEvent.ACTION_POINTER_DOWN:
{
// We have a new multi-finger gesture
// as orientation can change, query the metrics in touch down
android.util.DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
mRightSlopEdge = metrics.widthPixels - mEdgeSlop;
mBottomSlopEdge = metrics.heightPixels - mEdgeSlop;
if (mPrevEvent != null)
{
mPrevEvent.recycle();
}
mPrevEvent = android.view.MotionEvent.obtain(@event);
mTimeDelta = 0;
int index1 = @event.getActionIndex();
int index0 = @event.findPointerIndex(mActiveId0);
mActiveId1 = @event.getPointerId(index1);
if (index0 < 0 || index0 == index1)
{
// Probably someone sending us a broken event stream.
index0 = findNewActiveIndex(@event, index0 == index1 ? -1 : mActiveId1, index0);
mActiveId0 = @event.getPointerId(index0);
}
mActive0MostRecent = false;
setContext(@event);
// Check if we have a sloppy gesture. If so, delay
// the beginning of the gesture until we're sure that's
// what the user wanted. Sloppy gestures can happen if the
// edge of the user's hand is touching the screen, for example.
float edgeSlop = mEdgeSlop;
float rightSlop = mRightSlopEdge;
float bottomSlop = mBottomSlopEdge;
float x0 = getRawX(@event, index0);
float y0 = getRawY(@event, index0);
float x1 = getRawX(@event, index1);
float y1 = getRawY(@event, index1);
bool p0sloppy = x0 < edgeSlop || y0 < edgeSlop || x0 > rightSlop || y0 > bottomSlop;
bool p1sloppy = x1 < edgeSlop || y1 < edgeSlop || x1 > rightSlop || y1 > bottomSlop;
if (p0sloppy && p1sloppy)
{
mFocusX = -1;
mFocusY = -1;
mSloppyGesture = true;
}
else
{
if (p0sloppy)
{
mFocusX = @event.getX(index1);
mFocusY = @event.getY(index1);
mSloppyGesture = true;
}
else
{
if (p1sloppy)
{
mFocusX = @event.getX(index0);
mFocusY = @event.getY(index0);
mSloppyGesture = true;
}
else
{
mSloppyGesture = false;
mGestureInProgress = mListener.onScaleBegin(this);
}
//.........这里部分代码省略.........
示例2: onTouchEvent
//.........这里部分代码省略.........
case android.view.MotionEvent.ACTION_MOVE:
{
int expectedPointerCount = Sharpen.Util.IntGetBitCount(mTouchEventStreamPointers);
if (pointerCount != expectedPointerCount)
{
problem("ACTION_MOVE contained " + pointerCount + " pointers but there are currently "
+ expectedPointerCount + " pointers down.");
mTouchEventStreamIsTainted = true;
}
break;
}
case android.view.MotionEvent.ACTION_CANCEL:
{
mTouchEventStreamPointers = 0;
mTouchEventStreamIsTainted = false;
break;
}
case android.view.MotionEvent.ACTION_OUTSIDE:
{
if (mTouchEventStreamPointers != 0)
{
problem("ACTION_OUTSIDE but pointers are still down.");
}
ensureHistorySizeIsZeroForThisAction(@event);
ensurePointerCountIsOneForThisAction(@event);
mTouchEventStreamIsTainted = false;
break;
}
default:
{
int actionMasked = @event.getActionMasked();
int actionIndex = @event.getActionIndex();
if (actionMasked == android.view.MotionEvent.ACTION_POINTER_DOWN)
{
if (mTouchEventStreamPointers == 0)
{
problem("ACTION_POINTER_DOWN but no other pointers were down.");
mTouchEventStreamIsTainted = true;
}
if (actionIndex < 0 || actionIndex >= pointerCount)
{
problem("ACTION_POINTER_DOWN index is " + actionIndex + " but the pointer count is "
+ pointerCount + ".");
mTouchEventStreamIsTainted = true;
}
else
{
int id = @event.getPointerId(actionIndex);
int idBit = 1 << id;
if ((mTouchEventStreamPointers & idBit) != 0)
{
problem("ACTION_POINTER_DOWN specified pointer id " + id + " which is already down."
);
mTouchEventStreamIsTainted = true;
}
else
{
mTouchEventStreamPointers |= idBit;
}
}
ensureHistorySizeIsZeroForThisAction(@event);
}
else
示例3: dispatchTrackballEvent
public override bool dispatchTrackballEvent(android.view.MotionEvent @event)
{
int action = @event.getActionMasked();
if (action == android.view.MotionEvent.ACTION_CANCEL || action == android.view.MotionEvent
.ACTION_UP)
{
removeAllCallbacks();
}
return base.dispatchTrackballEvent(@event);
}
示例4: dispatchTouchEvent
public override bool dispatchTouchEvent(android.view.MotionEvent @event)
{
int action = @event.getActionMasked();
switch (action)
{
case android.view.MotionEvent.ACTION_MOVE:
{
if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE)
{
removeAllCallbacks();
forceCompleteChangeCurrentByOneViaScroll();
}
break;
}
case android.view.MotionEvent.ACTION_CANCEL:
case android.view.MotionEvent.ACTION_UP:
{
removeAllCallbacks();
break;
}
}
return base.dispatchTouchEvent(@event);
}
示例5: onTouchEvent
public override bool onTouchEvent(android.view.MotionEvent ev)
{
if (!isEnabled())
{
return false;
}
if (mVelocityTracker == null)
{
mVelocityTracker = android.view.VelocityTracker.obtain();
}
mVelocityTracker.addMovement(ev);
int action = ev.getActionMasked();
switch (action)
{
case android.view.MotionEvent.ACTION_MOVE:
{
float currentMoveY = ev.getY();
if (mBeginEditOnUpEvent || mScrollState != android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL)
{
int deltaDownY = (int)System.Math.Abs(currentMoveY - mLastDownEventY);
if (deltaDownY > mTouchSlop)
{
mBeginEditOnUpEvent = false;
onScrollStateChange(android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL
);
}
}
int deltaMoveY = (int)(currentMoveY - mLastMotionEventY);
scrollBy(0, deltaMoveY);
invalidate();
mLastMotionEventY = currentMoveY;
break;
}
case android.view.MotionEvent.ACTION_UP:
{
if (mBeginEditOnUpEvent)
{
setSelectorWheelState(SELECTOR_WHEEL_STATE_SMALL);
showInputControls(mShowInputControlsAnimimationDuration);
mInputText.requestFocus();
return true;
}
android.view.VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumFlingVelocity);
int initialVelocity = (int)velocityTracker.getYVelocity();
if (System.Math.Abs(initialVelocity) > mMinimumFlingVelocity)
{
fling(initialVelocity);
onScrollStateChange(android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_FLING
);
}
else
{
if (mAdjustScrollerOnUpEvent)
{
if (mFlingScroller.isFinished() && mAdjustScroller.isFinished())
{
postAdjustScrollerCommand(0);
}
}
else
{
postAdjustScrollerCommand(SHOW_INPUT_CONTROLS_DELAY_MILLIS);
}
}
mVelocityTracker.recycle();
mVelocityTracker = null;
break;
}
}
return true;
}
示例6: onInterceptTouchEvent
public override bool onInterceptTouchEvent(android.view.MotionEvent @event)
{
if (!isEnabled() || !mFlingable)
{
return false;
}
switch (@event.getActionMasked())
{
case android.view.MotionEvent.ACTION_DOWN:
{
mLastMotionEventY = mLastDownEventY = @event.getY();
removeAllCallbacks();
mShowInputControlsAnimator.cancel();
mDimSelectorWheelAnimator.cancel();
mBeginEditOnUpEvent = false;
mAdjustScrollerOnUpEvent = true;
if (mSelectorWheelState == SELECTOR_WHEEL_STATE_LARGE)
{
bool scrollersFinished = mFlingScroller.isFinished() && mAdjustScroller.isFinished
();
if (!scrollersFinished)
{
mFlingScroller.forceFinished(true);
mAdjustScroller.forceFinished(true);
onScrollStateChange(android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_IDLE
);
}
mBeginEditOnUpEvent = scrollersFinished;
mAdjustScrollerOnUpEvent = true;
hideInputControls();
return true;
}
if (isEventInViewHitRect(@event, mInputText) || (!mIncrementButton.isShown() && isEventInViewHitRect
(@event, mIncrementButton)) || (!mDecrementButton.isShown() && isEventInViewHitRect
(@event, mDecrementButton)))
{
mAdjustScrollerOnUpEvent = false;
setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE);
hideInputControls();
return true;
}
break;
}
case android.view.MotionEvent.ACTION_MOVE:
{
float currentMoveY = @event.getY();
int deltaDownY = (int)System.Math.Abs(currentMoveY - mLastDownEventY);
if (deltaDownY > mTouchSlop)
{
mBeginEditOnUpEvent = false;
onScrollStateChange(android.widget.NumberPicker.OnScrollListenerClass.SCROLL_STATE_TOUCH_SCROLL
);
setSelectorWheelState(SELECTOR_WHEEL_STATE_LARGE);
hideInputControls();
return true;
}
break;
}
}
return false;
}
示例7: onInterceptTouchEvent
internal virtual bool onInterceptTouchEvent(android.view.MotionEvent ev)
{
switch (ev.getActionMasked())
{
case android.view.MotionEvent.ACTION_DOWN:
{
if (mState > STATE_NONE && isPointInside(ev.getX(), ev.getY()))
{
if (!mList.isInScrollingContainer())
{
beginDrag();
return true;
}
mInitialTouchY = ev.getY();
startPendingDrag();
}
break;
}
case android.view.MotionEvent.ACTION_UP:
case android.view.MotionEvent.ACTION_CANCEL:
{
cancelPendingDrag();
break;
}
}
return false;
}