public bool OnTouch(View v, MotionEvent @event) { lock (this) { TouchEvent touchEvent = touchEventPool.newObject(); switch (@event.GetAction()) { case MotionEvent.ACTION_DOWN: touchEvent.type = TouchEvent.TOUCH_DOWN; isTouched = true; break; case MotionEvent.ACTION_MOVE: touchEvent.type = TouchEvent.TOUCH_DRAGGED; isTouched = true; break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: touchEvent.type = TouchEvent.TOUCH_UP; isTouched = false; break; } touchEvent.x = touchX = (int) (@event.GetX()*scaleX); touchEvent.y = touchY = (int) (@event.GetY()*scaleY); touchEventsBuffer.Add(touchEvent); return true; } }
public bool OnTouch(View view, MotionEvent ev) { //if (ev.GetAction() == MotionEvent.ACTION_MOVE) { ClipData data = ClipData.NewPlainText("DragData", ""); view.StartDrag(data, new Android.View.View.DragShadowBuilder(view), (Object)new MoveDragData { draggedView = view, dragHandler = this }, 0); } return true; }
public bool OnTouch(View view, MotionEvent ev) { //if (inDrag == false) //{ inDrag = true; ClipData data = ClipData.NewPlainText("SpeechDragData", ""); view.StartDrag(data, new Android.View.View.DragShadowBuilder(view), (Object)new SpeechDragData { draggedView = view, dragHandler = this }, 0); //} return true; }
public bool OnTouch(View v, MotionEvent @event) { lock (this) { int action = @event.GetAction() & MotionEvent.ACTION_MASK; int pointerIndex = (@event.GetAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; int pointerCount = @event.GetPointerCount(); TouchEvent touchEvent; for (int i = 0; i < MAX_TOUCHPOINTS; i++) { if (i >= pointerCount) { isTouched[i] = false; id[i] = -1; continue; } int pointerId = @event.GetPointerId(i); if (@event.GetAction() != MotionEvent.ACTION_MOVE && i != pointerIndex) { // if it's an up/down/cancel/out event, mask the id to see if we should process it for this touch // point continue; } switch (action) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_DOWN; touchEvent.pointer = pointerId; touchEvent.x = touchX[i] = (int) (@event.GetX(i)*scaleX); touchEvent.y = touchY[i] = (int) (@event.GetY(i)*scaleY); isTouched[i] = true; id[i] = pointerId; touchEventsBuffer.Add(touchEvent); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_CANCEL: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_UP; touchEvent.pointer = pointerId; touchEvent.x = touchX[i] = (int) (@event.GetX(i)*scaleX); touchEvent.y = touchY[i] = (int) (@event.GetY(i)*scaleY); isTouched[i] = false; id[i] = -1; touchEventsBuffer.Add(touchEvent); break; case MotionEvent.ACTION_MOVE: touchEvent = touchEventPool.newObject(); touchEvent.type = TouchEvent.TOUCH_DRAGGED; touchEvent.pointer = pointerId; touchEvent.x = touchX[i] = (int) (@event.GetX(i)*scaleX); touchEvent.y = touchY[i] = (int) (@event.GetY(i)*scaleY); isTouched[i] = true; id[i] = pointerId; touchEventsBuffer.Add(touchEvent); break; } } return true; } }
public override bool OnTouchEvent(MotionEvent @event) { mX = @event.X; mY = @event.Y; return true; }