DragEvent getY - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for DragEvent getY method.

This code example shows how to use the following methods:getAction, getClipData, getLocalState, getX, getY
	} 
 
	@Override 
	public boolean onDrag(View v, DragEvent event)
	{ 
		switch (event.getAction())
		{ 
		case DragEvent.ACTION_DRAG_STARTED: 
			Log.d("drag", "registered");
			break; 
			 
		case DragEvent.ACTION_DRAG_ENTERED:
				 
			break; 
 
		case DragEvent.ACTION_DRAG_LOCATION:
			break; 
 
		case DragEvent.ACTION_DRAG_ENDED:
			 

6
CodeRank
This code example shows how to use the following methods:getAction, getLocalState, getX, getY
    } 
	 
	private class PlaceDragListener implements OnDragListener {
		@Override 
		public boolean onDrag(View v, DragEvent event) {
			switch (event.getAction()) {
			    case DragEvent.ACTION_DROP:
			    	Toast.makeText(contextt, "ACTION_DROP", Toast.LENGTH_LONG).show();
			    	View view = (View) event.getLocalState();
			    	ViewGroup owner = (ViewGroup) view.getParent();
			    	owner.removeView(view);
			    	 
			    	FrameLayout container = (FrameLayout) v.getParent();
			        container.addView(view);
			        container.bringChildToFront(view);
			        view.setX((int)event.getX() + 5 - view.getWidth() / 2);
			        view.setY((int)event.getY() + 5 - view.getHeight() / 2);
			        view.setVisibility(View.VISIBLE);			        
			        break; 
			    default : 

6
CodeRank
This code example shows how to use the following methods:getAction, getClipData, getX, getY
    	    private static final String DROPTAG = "DropTarget";
    		private int dropCount = 0;
			private ObjectAnimator anim;
 
			public boolean onDrag(View v, DragEvent event) {
				int action = event.getAction();
				boolean result = true;
				switch(action) {
				case DragEvent.ACTION_DRAG_STARTED:
					Log.v(DROPTAG, "drag started in dropTarget");
		            break; 
				case DragEvent.ACTION_DRAG_ENTERED:
					Log.v(DROPTAG, "drag entered dropTarget");
				    anim = ObjectAnimator.ofFloat((Object)v, "alpha", 1f, 0.5f);
				    anim.setInterpolator(new CycleInterpolator(40));
				    anim.setDuration(30*1000); // 30 seconds
				    anim.start();
		            break; 
				case DragEvent.ACTION_DRAG_EXITED:
					Log.v(DROPTAG, "drag exited dropTarget");

6
CodeRank
This code example shows how to use the following methods:getAction, getClipData, getX, getY
			private static final String DROPTAG = "DropTarget";
			private int dropCount = 0;
			private ObjectAnimator anim;
 
			public boolean onDrag(View v, DragEvent event) {
				int action = event.getAction();
				boolean result = true;
				switch (action) {
				case DragEvent.ACTION_DRAG_STARTED:
					Log.v(DROPTAG, "drag started in dropTarget");
					break; 
				case DragEvent.ACTION_DRAG_ENTERED:
					Log.v(DROPTAG, "drag entered dropTarget");
					anim = ObjectAnimator
							.ofFloat((Object) v, "alpha", 1f, 0.5f);
					anim.setInterpolator(new CycleInterpolator(40));
					anim.setDuration(30 * 1000); // 30 seconds
					anim.start();
					break; 
				case DragEvent.ACTION_DRAG_EXITED:

6
CodeRank
This code example shows how to use the following methods:getAction, getX, getY
			 
			@Override 
			public boolean onDrag(View v, DragEvent event) {
 
			    boolean result = true;
			    int action = event.getAction();
			    float x = event.getX();
			    float y = event.getY();
			    v.setX(x);
			    v.setY(y);
			    switch (action) {
			    case DragEvent.ACTION_DRAG_STARTED:
			    	Log.d("START", "START");
			      break; 
			    case DragEvent.ACTION_DRAG_LOCATION:
			    	Log.d("LOCATION", "LOCATION");
			      break; 
			    case DragEvent.ACTION_DRAG_ENTERED:
			      break; 
			    case DragEvent.ACTION_DRAG_EXITED:
5
CodeRank
This code example shows how to use the following methods:getAction, getLocalState, getY
	} 
 
	// Drag and Drop 
	@Override 
	public boolean onDragEvent(DragEvent event) {
		int action = event.getAction();
		int vCenter = getHeight() / 2;
		switch (action) {
		case DragEvent.ACTION_DRAG_STARTED:
			return true; 
		case DragEvent.ACTION_DRAG_ENTERED:
			return true; 
		case DragEvent.ACTION_DRAG_LOCATION:
			if (event.getY() < vCenter) {
				// TODO: Highlight top borderline 
				setBackgroundResource(android.R.drawable.divider_horizontal_dark);
			} 
			else { 
				// TODO: Highlight bottom borderline 
				setBackgroundResource(android.R.drawable.divider_horizontal_dark);

5
CodeRank
This code example shows how to use the following methods:getX, getY
	} 
 
	@Override 
	public boolean onDrag(View arg0, DragEvent e) {
		if (curve.isCaptured()) {
			float x = e.getX();
			float y = e.getY();
			if (x < 0)
				x = 0;
			if (y < 0)
				y = 0;
			if (x > width)
				x = width;
			if (y > height)
				y = height;
			curve.setCursorPosition(x, y);
		} 
		return false; 
	} 
 
5
CodeRank
This code example shows how to use the following methods:getX, getY
		return false; 
	} 
 
	@TargetApi(11) 
	public boolean onDrag(View v, DragEvent event) {
        double x = ((event.getX()/v.getWidth())-0.5)*2*127;
        double y = ((event.getY()/v.getHeight())-0.5)*2*127;
        Log.i("touch", "x="+x+", y="+y);
		// TODO Auto-generated method stub 
		return false; 
	} 
} 
4
CodeRank

Related DragEvent getY Questions & Answers:

getY Method Overview
Gets the Y coordinate of the drag point.
See Code Examples for other Android DragEvent Methods: