case DragEvent.ACTION_DRAG_STARTED: if (event.getLocalState()==null || !event .getClipDescription() .hasMimeType(ClipDescription.MIMETYPE_TEXT_URILIST)) { result=false;
case DragEvent.ACTION_DRAG_STARTED: if (event .getClipDescription() .hasMimeType(ClipDescription.MIMETYPE_TEXT_URILIST)) { applyDropHint(v, R.drawable.droppable);
case DragEvent.ACTION_DRAG_STARTED: if (event .getClipDescription() .hasMimeType(ClipDescription.MIMETYPE_TEXT_URILIST)) { applyDropHint(v, R.drawable.droppable);
case DragEvent.ACTION_DRAG_STARTED: if (event .getClipDescription() .hasMimeType(ClipDescription.MIMETYPE_TEXT_URILIST)) { applyDropHint(v, R.drawable.droppable);
case DragEvent.ACTION_DRAG_STARTED: if (event .getClipDescription() .hasMimeType(ClipDescription.MIMETYPE_TEXT_URILIST)) { applyDropHint(v, R.drawable.droppable);
public class YourEditText extends EditText { ... // other stuff ... @Override public boolean onDragEvent(DragEvent event) { switch (event.getAction()) { case DragEvent.ACTION_DRAG_STARTED: if (event.getClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) { return true; } return false; default: return super.onDragEvent(event); } }
switch (event.getAction()) { case DragEvent.ACTION_DRAG_STARTED: if (event.getClipDescription().hasMimeType( ClipDescription.MIMETYPE_TEXT_PLAIN)) { return true;
@Override public boolean onDrag(final View v, final DragEvent event) { final boolean fromMe = (Integer) event.getLocalState() == 0; if (event.getAction() == DragEvent.ACTION_DRAG_STARTED && fromMe) { if (BuildConfig.DEBUG) { final String card = event.getClipDescription().getLabel().toString(); Log.d(GameActivity.TAG, "Drag W: Started of " + card); } return true; } else if (event.getAction() == DragEvent.ACTION_DRAG_ENDED && !event.getResult() && fromMe) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) System.gc(); handler.post(new Runnable() { @Override public void run() { gameState.attemptAutoMoveFromWasteToFoundation(); } }); return true; } return false; } });
if (event.getClipDescription() .hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN))
@TargetApi(Build.VERSION_CODES.N) private void handleSystemDragStart(DragEvent event) { if (!FeatureFlags.LAUNCHER3_USE_SYSTEM_DRAG_DRIVER || !Utilities.isNycOrAbove()) { return; } if (mLauncher.isWorkspaceLocked()) { return; } ClipDescription description = event.getClipDescription(); if (!description.hasMimeType(ClipDescription.MIMETYPE_TEXT_INTENT)) { return; } ShortcutInfo info = new ShortcutInfo(); // Set a dummy intent until we get the final value info.intent = new Intent(); // Since we are not going through the workspace for starting the drag, set drag related // information on the workspace before starting the drag. ExternalDragPreviewProvider previewProvider = new ExternalDragPreviewProvider(mLauncher, info); mLauncher.getWorkspace().prepareDragWithProvider(previewProvider); DragOptions options = new DragOptions(); options.systemDndStartPoint = new Point((int) event.getX(), (int) event.getY()); int halfPadding = previewProvider.previewPadding / 2; mDragController.startDrag( Bitmap.createBitmap(1, 1, Config.ARGB_8888), 0, 0, new AnotherWindowDragSource(mLauncher), info, new Point(- halfPadding, halfPadding), previewProvider.getPreviewBounds(), 1f, options); }
final boolean isMyCascade = laneId == (Integer) event.getLocalState(); if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) { String card = event.getClipDescription().getLabel().toString(); if (isMyCascade) { if (BuildConfig.DEBUG)
@TargetApi(Build.VERSION_CODES.N) private void handleSystemDragStart(DragEvent event) { if (!FeatureFlags.LAUNCHER3_USE_SYSTEM_DRAG_DRIVER || !Utilities.isNycOrAbove()) { return; } if (mLauncher.isWorkspaceLocked()) { return; } ClipDescription description = event.getClipDescription(); if (!description.hasMimeType(ClipDescription.MIMETYPE_TEXT_INTENT)) { return; } ShortcutInfo info = new ShortcutInfo(); // Set a dummy intent until we get the final value info.intent = new Intent(); // Since we are not going through the workspace for starting the drag, set drag related // information on the workspace before starting the drag. ExternalDragPreviewProvider previewProvider = new ExternalDragPreviewProvider(mLauncher, info); mLauncher.getWorkspace().prepareDragWithProvider(previewProvider); DragOptions options = new DragOptions(); options.systemDndStartPoint = new Point((int) event.getX(), (int) event.getY()); int halfPadding = previewProvider.previewPadding / 2; mDragController.startDrag( Bitmap.createBitmap(1, 1, Config.ARGB_8888), 0, 0, new AnotherWindowDragSource(mLauncher), info, new Point(- halfPadding, halfPadding), previewProvider.getPreviewBounds(), 1f, options); }
if (event.getClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
/** * Responds to drag events on the foundation * * @see android.view.View.OnDragListener#onDrag(android.view.View, android.view.DragEvent) */ @Override public boolean onDrag(final View v, final DragEvent event) { final boolean isMyFoundation = foundationIndex == (Integer) event.getLocalState(); if (event.getAction() == DragEvent.ACTION_DRAG_STARTED) { final String foundationCard = gameState.getFoundationCard(foundationIndex); if (isMyFoundation) { if (BuildConfig.DEBUG) Log.d(GameActivity.TAG, "Drag " + foundationIndex + ": Started of " + foundationCard); return false; } final String card = event.getClipDescription().getLabel().toString(); return gameState.acceptFoundationDrop(foundationIndex, card); } else if (event.getAction() == DragEvent.ACTION_DROP) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) System.gc(); final String card = event.getClipData().getItemAt(0).getText().toString(); final int from = (Integer) event.getLocalState(); gameState.move(new Move(Move.Type.PLAYER_MOVE, foundationIndex, from, card)); return true; } return true; } }
switch (dragEvent.getAction()) { case DragEvent.ACTION_DRAG_STARTED: return isSupported(dragEvent.getClipDescription(), DRAGNDROP_SUPPORTED_MIMETYPES_TEXT) || isSupported(dragEvent.getClipDescription(), DRAGNDROP_SUPPORTED_MIMETYPES_IMAGE); case DragEvent.ACTION_DRAG_ENTERED: case DragEvent.ACTION_DROP: if (mSourceView.getVisibility() == View.VISIBLE) { if (isSupported(dragEvent.getClipDescription(), DRAGNDROP_SUPPORTED_MIMETYPES_IMAGE)) { if (isSupported(dragEvent.getClipDescription(), DRAGNDROP_SUPPORTED_MIMETYPES_IMAGE) && ("zss_field_title".equals(mFocusedFieldId))) { ClipDescription clipDescription = dragEvent.getClipDescription(); if (clipDescription.getMimeTypeCount() < 1) { break;
return false; ClipDescription desc = event.getClipDescription(); if (desc == null || !desc.hasMimeType(getMimeType())) { return false;
if (DragUtils.isDragForMe(event.getClipDescription().getLabel())) {
mLastY = event.getY(); mReceivedDropEvent = updateInfoFromClipData(event.getClipData(), event.getClipDescription()); return mReceivedDropEvent;
mLastY = event.getY(); mReceivedDropEvent = updateInfoFromClipData(event.getClipData(), event.getClipDescription()); return mReceivedDropEvent;
return DragUtils.isDragForMe(event.getClipDescription().getLabel()); case DragEvent.ACTION_DRAG_ENDED: return true;