Android View.DragShadowBuilder - 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 View.DragShadowBuilder class.

This code example shows how to use the following methods:
 
	private final class MyTouchListener implements OnTouchListener {
		public boolean onTouch(View view, MotionEvent motionEvent) {
			if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
				ClipData data = ClipData.newPlainText("", "");
				DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(
						view);
				view.startDrag(data, shadowBuilder, view, 0);
				view.setVisibility(View.INVISIBLE);
				return true; 
			} else { 
				return false; 
			} 
		} 
	} 
 
	class MyDragListener implements OnDragListener {
		Drawable enterShape = getResources().getDrawable(
				R.drawable.shape_droptarget); 
		Drawable normalShape = getResources().getDrawable(R.drawable.shape);
6
CodeRank
This code example shows how to use the following methods:
	private final class MyTouchListener implements OnTouchListener {
	    public boolean onTouch(View view, MotionEvent motionEvent) {
	    	 
	      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
	        ClipData data = ClipData.newPlainText("", "");
	        DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
	        view.startDrag(data, shadowBuilder, view, 0);
	        view.setVisibility(View.INVISIBLE);
	        	return true; 
	       }  
	      else { 
	        return false; 
	      } 
	    } 
	  } 
	 
	class MyDragListener implements OnDragListener {
	    Drawable enterShape = getResources().getDrawable(R.drawable.shape_droptarget);
	    Drawable normalShape = getResources().getDrawable(R.drawable.shape);
 
4
CodeRank
This code example shows how to use the following methods:
 
	private final class MyTouchListener implements OnTouchListener {
		public boolean onTouch(View view, MotionEvent motionEvent) {
			if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
				ClipData data = ClipData.newPlainText("", "");
				DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(
						view);
				view.startDrag(data, shadowBuilder, view, 0);
				view.setVisibility(View.INVISIBLE);
				return true; 
 
			} else { 
 
				return false; 
			} 
		} 
	} 
 
	class MyDragListener implements OnDragListener {
		Drawable enterShape = getResources().getDrawable(
4
CodeRank
This code example shows how to use the following methods:
	 private final class MyTouchListener implements OnTouchListener {
		    @Override 
			public boolean onTouch(View view, MotionEvent motionEvent) {
		      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
		        ClipData data = ClipData.newPlainText("", "");
		        DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
		        view.startDrag(data, shadowBuilder, view, 0);
		        view.setVisibility(View.INVISIBLE);
		        return true; 
		      } else { 
		        return false; 
		      } 
		    } 
		  } 
 
		   
	  
	 class MyDragListener implements OnDragListener {
	    
	   @Override 
4
CodeRank
This code example shows how to use the following methods:
	 
	private final class MyTouchListener implements OnTouchListener {
	    public boolean onTouch(View view, MotionEvent motionEvent) {
	      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
	        ClipData data = ClipData.newPlainText("", "");
	        DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
	        view.startDrag(data, shadowBuilder, view, 0);
	        view.setVisibility(View.INVISIBLE);
	        return true; 
	      } else { 
	        return false; 
	      } 
	       
	    } 
	} 
 
	private boolean dropEventNotHandled(DragEvent dragEvent) {
		        return !dragEvent.getResult();
	} 
	 
4
CodeRank
This code example shows how to use the following methods:
 
	@SuppressLint("NewApi") 
	public void startDrag(View v){
		if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
			ClipData dragData = ClipData.newPlainText((CharSequence)v.getTag(), (CharSequence)v.getTag());
			DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);
			v.startDrag(dragData, shadowBuilder, v, 0);
		} 
		else{ 
//			ViewGroup container = (ViewGroup) getView().findViewById(mContainer); 
//			int x = (int)event.getX() - offset_x; 
//			int y = (int)event.getY() - offset_y; 
//			int w = getActivity().getWindowManager().getDefaultDisplay().getWidth() - 100; 
//			int h = getActivity().getWindowManager().getDefaultDisplay().getHeight() - 100; 
//			if(x > w) 
//				x = w; 
//			if(y > h) 
//				y = h; 
//			RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( 
//			new ViewGroup.MarginLayoutParams( 
4
CodeRank
This code example shows how to use the following methods:
				/* 
				 * Drag details: we only need default behavior - clip data could 
				 * be set to pass data as part of drag - shadow can be tailored 
				 */ 
				ClipData data = ClipData.newPlainText("", "");
				DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(
						view);
				// start dragging the item touched 
				view.startDrag(data, shadowBuilder, view, 0);
				return true; 
			} else { 
				return false; 
			} 
		} 
	} 
 
	/** 
	 * DragListener will handle dragged views being dropped on the drop area - 
	 * only the drop action will have processing added to it as we are not - 
	 * amending the default behavior for other parts of the drag process 
4
CodeRank
This code example shows how to use the following methods:
	// This defines your touch listener 
	private final class MyTouchListener implements OnTouchListener {
	  public boolean onTouch(View view, MotionEvent motionEvent) {
	    if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
	      ClipData data = ClipData.newPlainText("", "");
	      DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
	      view.startDrag(data, shadowBuilder, view, 0);
	      view.setVisibility(View.INVISIBLE); //TODO:should show empty image
	      return true; 
	    } else { 
	    return false; 
	    } 
	  } 
	} 
	 
	class MyDragListener implements OnDragListener {		  
		  @Override 
		  public boolean onDrag(View template, DragEvent event) {
		    int action = event.getAction();
		    ImageView magnet = (ImageView) event.getLocalState();
4
CodeRank
This code example shows how to use the following methods:
 
	@Override 
	public boolean onTouch(View v, MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			ClipData data = ClipData.newPlainText("DragData", (String) v.getTag());
			DragShadowBuilder dsb = new View.DragShadowBuilder(v);
			v.startDrag(data, dsb, (Object) v, 1);
		} 
		return false; 
	} 
 
	@Override 
	public boolean onDrag(View v, DragEvent event) {
		if (event.getLocalState() != this) {
			return false; 
		} 
		boolean result = true;
		int action = event.getAction();
		switch (action) {
		case DragEvent.ACTION_DRAG_STARTED:
4
CodeRank
This code example shows how to use the following methods:
	private final class MyTouchListener implements OnTouchListener {
	  @Override 
	public boolean onTouch(View view, MotionEvent motionEvent) {
	    if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
			ClipData data = ClipData.newPlainText(" ", " ");
			DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
			view.startDrag(data, shadowBuilder, view, 0);
			view.setVisibility(View.INVISIBLE);
			return true; 
	    } else { 
	    	return false; 
	    } 
	  } 
	}  
} 
4
CodeRank

Related Android View.DragShadowBuilder Questions & Answers:

Other Android View.DragShadowBuilder Examples

34:	      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
35:	        ClipData data = ClipData.newPlainText("", "");
36:	        DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
37:	        view.startDrag(data, shadowBuilder, view, 0);
38:	        view.setVisibility(View.INVISIBLE);
-
34:	      if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
35:	        ClipData data = ClipData.newPlainText("", "");
36:	        DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
37:	        view.startDrag(data, shadowBuilder, view, 0);
38:	        view.setVisibility(View.INVISIBLE);

Read More

See Code Examples for Android View.DragShadowBuilder Methods: