Skip to content

Instantly share code, notes, and snippets.

@hkosacki
Created March 1, 2017 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkosacki/f743c71e70e6ca5d7aab575758981c47 to your computer and use it in GitHub Desktop.
Save hkosacki/f743c71e70e6ca5d7aab575758981c47 to your computer and use it in GitHub Desktop.
@Override
public boolean onDrag(View view, DragEvent dragEvent) {
Log.d("dragEvent", dragEvent.toString());
switch (dragEvent.getAction()) {
case DragEvent.ACTION_DRAG_ENDED:
Log.d("event", "ACTION_DRAG_ENDED");
dragLayout.setVisibility(View.GONE);
dragLayout.setBackgroundResource(R.drawable.drag_background);
return true;
case DragEvent.ACTION_DRAG_ENTERED:
Log.d("event", "ACTION_DRAG_ENTERED");
dragLayout.setBackgroundResource(R.drawable.drag_background_active);
return true;
case DragEvent.ACTION_DRAG_EXITED:
Log.d("event", "ACTION_DRAG_EXITED");
dragLayout.setBackgroundResource(R.drawable.drag_background);
return true;
case DragEvent.ACTION_DRAG_LOCATION:
Log.d("event", "ACTION_DRAG_LOCATION");
return true;
case DragEvent.ACTION_DRAG_STARTED:
Log.d("event", "ACTION_DRAG_STARTED");
dragLayout.setVisibility(View.VISIBLE);
return true;
case DragEvent.ACTION_DROP:
Log.d("event", "ACTION_DRAG_DROP");
handleDropEvent(view, dragEvent);
return true;
default:
Log.e("event", "unknown");
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment