Code example for DragEvent

Methods: getAction, getClipData

0
 
        @Override 
        public boolean onDragEvent(DragEvent event) {
            if (DEBUG) Slog.d(TAG, "onDragEvent: " + event);
            switch (event.getAction()) {
                // We want to appear whenever a potential drag takes off from anywhere in the UI. 
                case DragEvent.ACTION_DRAG_STARTED:
                    show(true); 
                    break; 
                case DragEvent.ACTION_DRAG_ENTERED:
                    if (DEBUG) Slog.d(TAG, "entered!");
                    // XXX: TODO 
                    break; 
                case DragEvent.ACTION_DRAG_EXITED:
                    if (DEBUG) Slog.d(TAG, "exited!");
                    break; 
                case DragEvent.ACTION_DROP:
                    if (DEBUG) Slog.d(TAG, "dropped!");
                    mPocket.stash(event.getClipData());
                    break; 
                case DragEvent.ACTION_DRAG_ENDED:
                    hide(true); 
                    break; 
            } 
            return true; // we want everything, thank you