DraggableView

Additional

Language
Java
Version
N/A
Created
Jun 30, 2017
Updated
Aug 28, 2018 (Retired)
Owner
Pratik Surela (PratikSurela)
Contributor
Pratik Surela (PratikSurela)
1
Activity
Badge
Generate
Download
Source code

DraggableView

Using DragableView you can merge various views into one layout with dragg and drop animation. For example if you have 3 ImageViews(fb,google,linkedin) and one MainImageView(Login with) 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(imgFacebook);
        draggableViewMain.addView(imgGoogle);
        draggableViewMain.addView(imgLinkedIn);

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, "Login with Facebook", Toast.LENGTH_SHORT).show();
        } else if (position == 1) {
            //do after view two dragged
            Toast.makeText(this, "Login with Google", Toast.LENGTH_SHORT).show();
        } else if (position == 2) {
            //do after view three dragged
            Toast.makeText(this, "Login with LinkedIn", Toast.LENGTH_SHORT).show();
        }
        return position;
    }

That's it...Enjoy...:)