Skip to content

nihatalim/Android-DragManager

Repository files navigation

DragList is gain drag events for all View elements

There is below example in this repository in app module

Alt Text

Step 1: Installation

Click this button

In the opening page, click the GET button which latest version. Then follow the instruction.

Step 2: Usage

a) Define DragManager instance on class level like this:

private DragManager dragManager = null;

b) Then init the DragManager:

this.dragManager =  DragManager.init(this.target);

Note: this.target is a View object like TextView, RecyclerView or ImageView. The DragManager.init(View TargetView) method needs to pass target view.

c) Define a listener like onlongclicklistener or ontouch etc. for another view which you want to drag. Then add to overrided method this line:

dragManager.drag(view,null);

DragManager.drag(View baseView, Object data) if you want to pass data from baseView to targetView you can change null to object instance.

this.base.setOnLongClickListener(new View.OnLongClickListener() {
	@Override
	public boolean onLongClick(View view) {
		return dragManager.drag(view,null);
	}
});

d) You can define drag actions. Fully supported actions now.

this.dragManager.OnDrag(new OnDrag<ViewData>(){
	@Override
	public void Drop(View view, DragEvent dragEvent, ViewData data) {
	}

	@Override
	public void DragEnded(View view, DragEvent dragEvent, ViewData data) {

	}

	@Override
	public void DragStarted(View view, DragEvent dragEvent, ViewData data) {
	}

	@Override
	public void DragEntered(View view, DragEvent dragEvent, ViewData data) {
	}

	@Override
	public void DragLocation(View view, DragEvent dragEvent, ViewData data) {

	}

	@Override
	public void DragExited(View view, DragEvent dragEvent, ViewData data) {
	}
});

z) Finally you need to build your dragManager instance.

this.dragManager.build();

or you can pass an identifier to animating on target view like this:

this.dragManager.build(Techniques.BounceInUp);

you can take more animating from: https://github.com/daimajia/AndroidViewAnimations

About

Drag and drop generic implementation library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages