Back to project page GhostStories.
The source code is released under:
GNU General Public License
If you think the Android project GhostStories listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package games.ghoststories.controllers.combat; // w w w .jav a 2s. c o m import games.ghoststories.data.DragData; import games.ghoststories.enums.EDragItem; import android.view.DragEvent; import android.view.View; import android.view.View.OnDragListener; /** * Drag and drop listener for the combat dice. */ /*package*/class DiceDragListener implements OnDragListener { /* * (non-Javadoc) * @see android.view.View.OnDragListener#onDrag(android.view.View, android.view.DragEvent) */ public boolean onDrag(View pView, DragEvent pEvent) { boolean handled = false; Object localState = pEvent.getLocalState(); if(localState instanceof DragData) { DragData dragData = (DragData)localState; //Dragging from the dice to the ghost if(dragData.getView() == pView && dragData.getDragItem() == EDragItem.COMBAT_DICE) { switch(pEvent.getAction()) { case DragEvent.ACTION_DRAG_ENDED: if(pEvent.getResult()) { pView.setEnabled(false); } handled = true; break; default: break; } } } return handled; } }