@Override public boolean canAcceptDrop() { if (mOnDropDelegate != null) { return mOnDropDelegate.checkDropDataAcceptable(null, this); } return false; }
@Override public boolean onDragEnded(DragEvent event) { boolean success = event.getResult(); if (mOnDropDelegate != null) { if (!success) { mOnDropDelegate.onDropFailed(this); } } return false; }
@Override public boolean onDrop(DragEvent event) { if (mUseAsAdapterViewChild) { setBackgroundColor(APLAH_TRANSPARENT); } if (mHoverCountDownTimer != null) { mHoverCountDownTimer.cancel(); } if (mOnDropDelegate != null) { Object data = mOnDropDelegate.generateDropData(); boolean result = true; if (mOnDropDelegate.checkDropDataAcceptable(data, this)) { result = mOnDropDelegate.handleDrop(data, this); if (result) { mOnDropDelegate.onDropSuccess(this); } else { mOnDropDelegate.onDropFailed(this); } } else { if (mOnDropDelegate.shouldDispathUnacceptableDropToParent(this)) { Log.i(TAG, "dispatch unacceptable drop to parent."); result = super.onDragEvent(event); } else { // Only notify drop denial when the view has indicated it could possibly // accept drop (Actual it could not) // Task 'canOpen' as a possible drop indicator because it also changed the UI // as the 'canAcceptDrop' did. User might tend to think it is dropable. if (canOpen()) { mOnDropDelegate.notifyDropDataDenied(data, this); } mOnDropDelegate.onDropFailed(this); } } return result; } return false; }
@Override public void onHover() { if (mOnDropDelegate != null) { mOnDropDelegate.onHover(this); } }