DraggableView
Using DragableView you can merge various views into one layout with dragg and drop animation. For example if you have 3 ImageViews(source view) and one MainImageView(destination view) and you want to implement drag-drop animation to drag one of the imageview(source) and drop on MainImageView(destination view).
Step 1 : Import module / add dependency into build.gradle "draggable-view".
compile 'com.app:draggable-views:1.0.0'
Step 2 : initlialize "DragableViewMain" class.
DraggableViewMain draggableViewMain = new DraggableViewMain(this, relativeLayoutObject);
Step 3 : Add views, that is source views.
draggableViewMain.addView(imgSourceOne);
draggableViewMain.addView(imgSourceTwo);
draggableViewMain.addView(imgSourceThree);
Step 4 : implements "OnViewSelection" interface. Step 5 : Override method "viewSelectedPosition(int position)".
@Override
public int viewSelectedPosition(int position) {
if (position == 0) {
//do after view one dragged
Toast.makeText(this, "dragged view position = " + position, Toast.LENGTH_SHORT).show();
}
else if (position == 1) {
//do after view two dragged
Toast.makeText(this, "dragged view position = " + position, Toast.LENGTH_SHORT).show();
}
else if (position == 2) {
//do after view three dragged
Toast.makeText(this, "dragged view position = " + position, Toast.LENGTH_SHORT).show();
}
return position;
}
That's it...Enjoy...:)