Android MotionEvent.PointerCoords - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android MotionEvent.PointerCoords class.

This code example shows how to use the following methods:
 
            mProperties = new PointerProperties();
            mProperties.id = id;
            mProperties.toolType = MotionEvent.TOOL_TYPE_FINGER;
 
            mCoords = new PointerCoords();
            mCoords.x = mStartX;
            mCoords.y = mStartY;
            mCoords.pressure = 1.0f;
        } 
 
        PointerProperties getProperties() {
            return mProperties;
        } 
 
        PointerCoords getCoords() {
            return mCoords;
        } 
 
        float getCurrentX() { 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	 * @param canvas to write on. 
	 */ 
	private void startTouch(MotionEvent event, Canvas canvas)
	{ 
		canvas.drawPoint(event.getX(), event.getY(), paint);
		this.previous = new PointerCoords();
		this.previous.x = event.getX();
		this.previous.y = event.getY();
	} 
 
	/** 
	 * Draw a line from previous point to here. 
	 * @param event specifies the coordinates. 
	 * @param canvas to write on. 
	 */ 
	private void continueTouch(MotionEvent event, Canvas canvas)
	{ 
		if (this.previous == null)
		{ 
			Log.e(LOG_TAG, "Could not continue touch");
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public boolean onTouch(View v, MotionEvent event) {
    	// TODO: Refactor 
		// Select corresponding list 
		LinkedList<LinkedList<MotionEvent.PointerCoords>> outerList = isForeground ? fgdStrokes : bgdStrokes;
		// Initialize coordinates object 
		MotionEvent.PointerCoords coordinates = new MotionEvent.PointerCoords();
		 
		// Distinguish in which phase we are 
		if (hasRect) {
			// 2nd phase 
			// Switch the different event types 
			switch (event.getAction()) {
				case MotionEvent.ACTION_DOWN:
					// We store the first position of the touch by generating a new list 
					event.getPointerCoords(0, coordinates);
					LinkedList<MotionEvent.PointerCoords> innerList = new LinkedList<MotionEvent.PointerCoords>();
					innerList.add(coordinates);
					outerList.add(innerList);
					break; 
				case MotionEvent.ACTION_MOVE:
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		case MotionEvent.ACTION_MOVE:
			if (numTouches == 2) {
				mode = InteractionMode.TOUCHZOOM;
				PointerCoords tchPnt1 = new PointerCoords();
				event.getPointerCoords(0, tchPnt1);
				PointerCoords tchPnt2 = new PointerCoords();
				event.getPointerCoords(1, tchPnt2);
 
				double pinchDist = Math.sqrt((tchPnt1.x - tchPnt2.x)
						* (tchPnt1.x - tchPnt2.x) + (tchPnt1.y - tchPnt2.y)
						* (tchPnt1.y - tchPnt2.y));
				if (pinchDistBegan >= 0) {
					int pinchOffset = (int) (pinchDist - pinchDistBegan);
					zoomLevel = zoomLevelBegan + pinchOffset / MINZOOMFOOTSTEP;
					// Log.d(LOGTAG, "zoom level: " + (int) zoomLevel); 
				} else { 
					pinchDistBegan = pinchDist;
					zoomLevelBegan = zoomLevel;
				} 
			} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
			 
			@Override 
			public boolean onTouch(View view, MotionEvent event) {
				// TODO Auto-generated method stub 
				int action = event.getAction();
				PointerCoords curCoord = new PointerCoords();
				event.getPointerCoords(0, curCoord);
				Calendar calendar = Calendar.getInstance();
				long curTime = calendar.getTimeInMillis();
				switch(action) {
				case MotionEvent.ACTION_DOWN:
					xTouchDown = event.getAxisValue(MotionEvent.AXIS_X);// curCoord.x;
					yTouchDown = curCoord.y;
					timeTouchDown = curTime;
					cntDataPoint = 0;
					break; 
//				case MotionEvent.ACTION_MOVE: 
					default: 
					int dt = (int) (curTime - timeTouchDown);
					if(dt < HANDEDNESSTIMEOUT) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	@Override 
	public boolean onTouchEvent (MotionEvent event) {
		super.onTouchEvent(event);
		 
		int numTouches = event.getPointerCount();
		PointerCoords tchPnt = new PointerCoords();
		event.getPointerCoords(0, tchPnt);
		float x = tchPnt.x;
		float y = tchPnt.y;
 
		if (numTouches == 1) {
			ShiftManager.shift(this, x, y, shiftWidth, shiftHeight);
		} 
		return true; 
		 
	} 
 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		this.x = x;
		this.y = y;
	} 
	 
	public static Vector2 FromMotionEvent(MotionEvent event, int pointer) {
		PointerCoords pc = new PointerCoords();
		event.getPointerCoords(pointer, pc);
		 
		return new Vector2(pc.x, pc.y);
	} 
	 
	public float x, y;
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        private long mDownTime;
        private long mLastTime;
        private long mCurrentTime;
         
        private PointerCoords mCoords = new PointerCoords();
        private PointerCoords mLastCoords = new PointerCoords();
        private PointerCoords mFirstCoords = new PointerCoords();
         
        /** 
         * Recycles this Pointer. You should call this method after evaluating this Pointer. 
         */ 
        public void recycle() { 
            if (!mDown) {
                mId = POINTER_ID_UNUSED;
            } 
        } 
         
        /** 
         * Returns the ID of this pointer. The ID will remain the same while the pointer isDown(). 
         */ 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Android MotionEvent.PointerCoords Methods: