List of usage examples for android.view MotionEvent ACTION_POINTER_1_UP
int ACTION_POINTER_1_UP
To view the source code for android.view MotionEvent ACTION_POINTER_1_UP.
Click Source Link
From source file:com.cssweb.android.view.KlineView.java
/** * true?,false??//www.ja v a2 s . c om */ public boolean onTouchEvent(MotionEvent motionEvent) { int count = motionEvent.getPointerCount(); if (count == 2) {// isTrackStatus = false; if (motionEvent.getAction() == MotionEvent.ACTION_POINTER_1_DOWN || motionEvent.getAction() == MotionEvent.ACTION_POINTER_2_DOWN) { float x0 = motionEvent.getX(0); float x1 = motionEvent.getX(1); float y0 = motionEvent.getY(0); float y1 = motionEvent.getY(1); distanceY0 = Math.abs(y1 - y0); distanceX0 = Math.abs(x1 - x0); } if (motionEvent.getAction() == MotionEvent.ACTION_POINTER_1_UP || motionEvent.getAction() == MotionEvent.ACTION_POINTER_2_UP) { float x0 = motionEvent.getX(0); float x1 = motionEvent.getX(1); float y0 = motionEvent.getY(0); float y1 = motionEvent.getY(1); distanceY1 = Math.abs(y1 - y0); distanceX1 = Math.abs(x1 - x0); if (distanceY1 > distanceY0 && distanceX1 > distanceX0) { upHandler(); } else if (distanceY1 < distanceY0 && distanceX1 < distanceX0) { downHandler(); } } return false; } else if (count == 1) {//?? switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: touchesBegan(motionEvent); break; case MotionEvent.ACTION_MOVE: touchesMoved(motionEvent); break; case MotionEvent.ACTION_UP: touchesEnded(motionEvent); break; } } return true; }