Loading docs/html/guide/topics/ui/drag-drop.jd +47 −59 Original line number Original line Diff line number Diff line Loading @@ -873,7 +873,7 @@ imageView.setOnDragListener(mDragListen); ... ... protected class myDragEventListener implements View.OnDragEventListener { protected class myDragEventListener implements View.OnDragListener { // This is the method that the system calls when it dispatches a drag event to the // This is the method that the system calls when it dispatches a drag event to the // listener. // listener. Loading Loading @@ -901,16 +901,13 @@ protected class myDragEventListener implements View.OnDragEventListener { // returns true to indicate that the View can accept the dragged data. // returns true to indicate that the View can accept the dragged data. return(true); return(true); } else { } // Returns false. During the current drag and drop operation, this View will // Returns false. During the current drag and drop operation, this View will // not receive events again until ACTION_DRAG_ENDED is sent. // not receive events again until ACTION_DRAG_ENDED is sent. return(false); return(false); } case DragEvent.ACTION_DRAG_ENTERED: break; case DragEvent.ACTION_DRAG_ENTERED: { // Applies a green tint to the View. Return true; the return value is ignored. // Applies a green tint to the View. Return true; the return value is ignored. Loading @@ -921,15 +918,11 @@ protected class myDragEventListener implements View.OnDragEventListener { return(true); return(true); break; case DragEvent.ACTION_DRAG_LOCATION: case DragEvent.ACTION_DRAG_LOCATION: // Ignore the event // Ignore the event return(true); return(true); break; case DragEvent.ACTION_DRAG_EXITED: case DragEvent.ACTION_DRAG_EXITED: // Re-sets the color tint to blue. Returns true; the return value is ignored. // Re-sets the color tint to blue. Returns true; the return value is ignored. Loading @@ -940,8 +933,6 @@ protected class myDragEventListener implements View.OnDragEventListener { return(true); return(true); break; case DragEvent.ACTION_DROP: case DragEvent.ACTION_DROP: // Gets the item containing the dragged data // Gets the item containing the dragged data Loading @@ -962,8 +953,6 @@ protected class myDragEventListener implements View.OnDragEventListener { // Returns true. DragEvent.getResult() will return true. // Returns true. DragEvent.getResult() will return true. return(true); return(true); break; case DragEvent.ACTION_DRAG_ENDED: case DragEvent.ACTION_DRAG_ENDED: // Turns off any color tinting // Turns off any color tinting Loading @@ -979,19 +968,18 @@ protected class myDragEventListener implements View.OnDragEventListener { } else { } else { Toast.makeText(this, "The drop didn't work.", Toast.LENGTH_LONG); Toast.makeText(this, "The drop didn't work.", Toast.LENGTH_LONG); }; } // returns true; the value is ignored. // returns true; the value is ignored. return(true); return(true); break; // An unknown action type was received. // An unknown action type was received. default: default: Log.e("DragDrop Example","Unknown action type received by OnDragListener."); Log.e("DragDrop Example","Unknown action type received by OnDragListener."); break; break; }; } }; return(false); } }; }; </pre> </pre> Loading
docs/html/guide/topics/ui/drag-drop.jd +47 −59 Original line number Original line Diff line number Diff line Loading @@ -873,7 +873,7 @@ imageView.setOnDragListener(mDragListen); ... ... protected class myDragEventListener implements View.OnDragEventListener { protected class myDragEventListener implements View.OnDragListener { // This is the method that the system calls when it dispatches a drag event to the // This is the method that the system calls when it dispatches a drag event to the // listener. // listener. Loading Loading @@ -901,16 +901,13 @@ protected class myDragEventListener implements View.OnDragEventListener { // returns true to indicate that the View can accept the dragged data. // returns true to indicate that the View can accept the dragged data. return(true); return(true); } else { } // Returns false. During the current drag and drop operation, this View will // Returns false. During the current drag and drop operation, this View will // not receive events again until ACTION_DRAG_ENDED is sent. // not receive events again until ACTION_DRAG_ENDED is sent. return(false); return(false); } case DragEvent.ACTION_DRAG_ENTERED: break; case DragEvent.ACTION_DRAG_ENTERED: { // Applies a green tint to the View. Return true; the return value is ignored. // Applies a green tint to the View. Return true; the return value is ignored. Loading @@ -921,15 +918,11 @@ protected class myDragEventListener implements View.OnDragEventListener { return(true); return(true); break; case DragEvent.ACTION_DRAG_LOCATION: case DragEvent.ACTION_DRAG_LOCATION: // Ignore the event // Ignore the event return(true); return(true); break; case DragEvent.ACTION_DRAG_EXITED: case DragEvent.ACTION_DRAG_EXITED: // Re-sets the color tint to blue. Returns true; the return value is ignored. // Re-sets the color tint to blue. Returns true; the return value is ignored. Loading @@ -940,8 +933,6 @@ protected class myDragEventListener implements View.OnDragEventListener { return(true); return(true); break; case DragEvent.ACTION_DROP: case DragEvent.ACTION_DROP: // Gets the item containing the dragged data // Gets the item containing the dragged data Loading @@ -962,8 +953,6 @@ protected class myDragEventListener implements View.OnDragEventListener { // Returns true. DragEvent.getResult() will return true. // Returns true. DragEvent.getResult() will return true. return(true); return(true); break; case DragEvent.ACTION_DRAG_ENDED: case DragEvent.ACTION_DRAG_ENDED: // Turns off any color tinting // Turns off any color tinting Loading @@ -979,19 +968,18 @@ protected class myDragEventListener implements View.OnDragEventListener { } else { } else { Toast.makeText(this, "The drop didn't work.", Toast.LENGTH_LONG); Toast.makeText(this, "The drop didn't work.", Toast.LENGTH_LONG); }; } // returns true; the value is ignored. // returns true; the value is ignored. return(true); return(true); break; // An unknown action type was received. // An unknown action type was received. default: default: Log.e("DragDrop Example","Unknown action type received by OnDragListener."); Log.e("DragDrop Example","Unknown action type received by OnDragListener."); break; break; }; } }; return(false); } }; }; </pre> </pre>