当前位置: 首页>>代码示例>>Java>>正文


Java DragEvent.ACTION_DRAG_ENDED属性代码示例

本文整理汇总了Java中android.view.DragEvent.ACTION_DRAG_ENDED属性的典型用法代码示例。如果您正苦于以下问题:Java DragEvent.ACTION_DRAG_ENDED属性的具体用法?Java DragEvent.ACTION_DRAG_ENDED怎么用?Java DragEvent.ACTION_DRAG_ENDED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.DragEvent的用法示例。


在下文中一共展示了DragEvent.ACTION_DRAG_ENDED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recordDragEvent

/**
 * Same as {@link #recordMotionEvent}. It creates a temporary {@link MotionEvent} object
 * using {@param event} for tracking velocity.
 */
void recordDragEvent(long dragStartTime, DragEvent event) {
    final int motionAction;
    switch (event.getAction()) {
        case DragEvent.ACTION_DRAG_STARTED:
            motionAction = MotionEvent.ACTION_DOWN;
            break;
        case DragEvent.ACTION_DRAG_LOCATION:
            motionAction = MotionEvent.ACTION_MOVE;
            break;
        case DragEvent.ACTION_DRAG_ENDED:
            motionAction = MotionEvent.ACTION_UP;
            break;
        default:
            return;
    }
    MotionEvent emulatedEvent = MotionEvent.obtain(dragStartTime, SystemClock.uptimeMillis(),
            motionAction, event.getX(), event.getY(), 0);
    recordMotionEvent(emulatedEvent);
    emulatedEvent.recycle();
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:24,代码来源:FlingToDeleteHelper.java

示例2: dispatchDragEvent

@Override
public boolean dispatchDragEvent(DragEvent e) {
    ContentViewCore contentViewCore = mTabVisible.getContentViewCore();
    if (contentViewCore == null) return false;

    if (mLayoutManager != null) mLayoutManager.getViewportPixel(mCacheViewport);
    contentViewCore.setCurrentTouchEventOffsets(-mCacheViewport.left, -mCacheViewport.top);
    boolean ret = super.dispatchDragEvent(e);

    int action = e.getAction();
    if (action == DragEvent.ACTION_DRAG_EXITED || action == DragEvent.ACTION_DRAG_ENDED
            || action == DragEvent.ACTION_DROP) {
        contentViewCore.setCurrentTouchEventOffsets(0.f, 0.f);
    }
    return ret;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:CompositorViewHolder.java

示例3: setOnDragListener

@Override
public void setOnDragListener(final View.OnDragListener dragListener) {
    View.OnDragListener wrapper = new OnDragListener() {
        @Override
        public boolean onDrag(View view, DragEvent dragEvent) {
            int action = dragEvent.getAction();
            // Whether the dragged object can be handled by the trash.
            boolean result = dragListener.onDrag(view, dragEvent);
            if (action == DragEvent.ACTION_DRAG_ENDED) {
                setState(STATE_DEFAULT);
            } else  if (result) {
                switch (action) {
                    case DragEvent.ACTION_DRAG_ENTERED:
                        setState(STATE_ON_HOVER);
                        break;
                    case DragEvent.ACTION_DROP:
                    case DragEvent.ACTION_DRAG_EXITED:
                        setState(STATE_DEFAULT);
                        break;
                }
            }
            return result;
        }
    };
    super.setOnDragListener(wrapper);
}
 
开发者ID:Axe-Ishmael,项目名称:Blockly,代码行数:26,代码来源:TrashCanView.java

示例4: onDrag

@Override
public boolean onDrag(View view, DragEvent dragEvent) {
    switch (dragEvent.getAction()) {
        case DragEvent.ACTION_DRAG_STARTED:
            AttachmentsProvider provider =
                    AttachmentsProviderFactory.getAttachmentProvider(getContext());
            return mCallback != null && provider.isSupported();
        case DragEvent.ACTION_DRAG_ENTERED:
            setBackgroundColor(ContextCompat.getColor(getContext(), R.color.attachmentOverlay));
            return isValidDragEvent(dragEvent.getClipData());
        case DragEvent.ACTION_DRAG_ENDED:
            setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
            return true;
        case DragEvent.ACTION_DRAG_EXITED:
        case DragEvent.ACTION_DRAG_LOCATION:
            return true;
        case DragEvent.ACTION_DROP:
            if (isValidDragEvent(dragEvent.getClipData())) {
                final List<Attachment> attachments = extractAttachments(dragEvent.getClipData());
                post(() -> mCallback.onAttachmentsDropped(attachments));
                return true;
            }
            // Fallback
    }
    return false;
}
 
开发者ID:jruesga,项目名称:rview,代码行数:26,代码来源:AttachmentDropView.java

示例5: dispatchDragEvent

@Override
public boolean dispatchDragEvent(DragEvent ev) {
    final DragEvent event = ev;
    boolean r = super.dispatchDragEvent(ev);
    if (r && (ev.getAction() == DragEvent.ACTION_DRAG_STARTED || ev.getAction() == DragEvent.ACTION_DRAG_ENDED)) {
        // If we got a start or end and the return value is true, our
        // onDragEvent wasn't called by ViewGroup.dispatchDragEvent
        // So we do it here.
        this.post(new Runnable() {
            @Override
            public void run() {
                onDragEvent(event);
            }
        });


        // fix crash on older versions of android
        try {
            super.dispatchDragEvent(ev);
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    }
    return r;
}
 
开发者ID:OpenLauncherTeam,项目名称:openlauncher,代码行数:25,代码来源:DragOptionView.java

示例6: handleDragEvent

private boolean handleDragEvent(final View v, final DragEvent event) {
    switch(event.getAction()) {
        case DragEvent.ACTION_DRAG_STARTED:
        case DragEvent.ACTION_DRAG_ENTERED:
        case DragEvent.ACTION_DRAG_LOCATION:
        case DragEvent.ACTION_DRAG_EXITED:
        case DragEvent.ACTION_DRAG_ENDED:
            return true;

        case DragEvent.ACTION_DROP:
            final String phrase = event.getClipData().getItemAt(0).getText().toString();
            moveViewToCorrectLocationFromDrag(v, phrase);
            return true;

        default:
            return false;
    }
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:18,代码来源:DragAndDropView.java

示例7: onDragEvent

@Override
public boolean onDragEvent(DragEvent event) {
    switch (event.getAction()) {
        case DragEvent.ACTION_DRAG_STARTED:
            return mEditor != null && mEditor.hasInsertionController();

        case DragEvent.ACTION_DRAG_ENTERED:
            TextView.this.requestFocus();
            return true;

        case DragEvent.ACTION_DRAG_LOCATION:
            final int offset = getOffsetForPosition(event.getX(), event.getY());
            Selection.setSelection((Spannable)mText, offset);
            return true;

        case DragEvent.ACTION_DROP:
            if (mEditor != null) mEditor.onDrop(event);
            return true;

        case DragEvent.ACTION_DRAG_ENDED:
        case DragEvent.ACTION_DRAG_EXITED:
        default:
            return true;
    }
}
 
开发者ID:AungThiha,项目名称:Tada,代码行数:25,代码来源:TextView.java

示例8: onDrag

public boolean onDrag(View v, DragEvent event) {
  final int action = event.getAction();

  switch (action) {
    case DragEvent.ACTION_DRAG_STARTED:
      return dragStart(v, event);
    case DragEvent.ACTION_DRAG_ENTERED:
      return true;
    case DragEvent.ACTION_DRAG_LOCATION:
      return this.dragLocation(v, event);
    case DragEvent.ACTION_DRAG_EXITED:
      return true;
    case DragEvent.ACTION_DROP:
      return this.dragDrop(v, event);
    case DragEvent.ACTION_DRAG_ENDED:
      return true;
    default:
      Log.e("MarkerDragEventListener", "Unknown action type received by OnDragListener.");
      break;
  }
  return false;
}
 
开发者ID:affinitybridge,项目名称:cordova-mapbox-android-sdk,代码行数:22,代码来源:Builder.java

示例9: createNewTableRow

private TableRow createNewTableRow() {
	TableRow row = new TableRow(getActivity()) {
		@Override
		public boolean dispatchDragEvent(DragEvent ev) {
			boolean r = super.dispatchDragEvent(ev);
			if (r && (ev.getAction() == DragEvent.ACTION_DRAG_STARTED || ev.getAction() == DragEvent.ACTION_DRAG_ENDED)) {
				// If we got a start or end and the return value is true,
				// our
				// onDragEvent wasn't called by ViewGroup.dispatchDragEvent
				// So we do it here.
				onDragEvent(ev);
			}
			return r;
		}
	};
	row.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
	row.setPadding(2, 5, 5, 2);
	return row;
}
 
开发者ID:markuskreth,项目名称:ClubHelperAndroid,代码行数:19,代码来源:PersonDetailFragment.java

示例10: onDragEvent

@Override
public boolean onDragEvent(DragEvent event) {
    switch (event.getAction()) {
    case DragEvent.ACTION_DRAG_STARTED:
        //Log.i(TAG, "Drag Started.");
        return onDragStarted(event);
    case DragEvent.ACTION_DRAG_ENTERED:
        Log.i(TAG, "Drag entered ADDV");
        return onDragEntered(event);
    case DragEvent.ACTION_DRAG_LOCATION:
        return onDragMoveOn(event);
    case DragEvent.ACTION_DRAG_EXITED:
        Log.i(TAG, "Drag exited ADDV");
        return onDragExited(event);
    case DragEvent.ACTION_DROP:
        Log.i(TAG, "Drag droped ADDV");
        return onDrop(event);
    case DragEvent.ACTION_DRAG_ENDED:
        //Log.i(TAG, "Drag ended ADDV.");
        return onDragEnded(event);
    }

    return super.onDragEvent(event);
}
 
开发者ID:nichollyn,项目名称:amddviews,代码行数:24,代码来源:AdaptableDragDropView.java

示例11: onDragEvent

@Override
public boolean onDragEvent(DragEvent event) {
    switch (event.getAction()) {
    case DragEvent.ACTION_DRAG_STARTED:
        //Log.i(TAG, "DropLV Drag Started.");
        return onDragStarted(event);
    case DragEvent.ACTION_DRAG_ENTERED:
        Log.i(TAG, "Drag entered DropLV.");
        return onDragEntered(event);
    case DragEvent.ACTION_DRAG_LOCATION:
        return onDragMoveOn(event);
    case DragEvent.ACTION_DRAG_EXITED:
        Log.i(TAG, "Drag exited DropLV.");
        return onDragExited(event);
    case DragEvent.ACTION_DROP:
        Log.i(TAG, "Drag droped DropLV.");
        return onDrop(event);
    case DragEvent.ACTION_DRAG_ENDED:
        //Log.i(TAG, "DropLV Drag ended.");
        return onDragEnded(event);
    }

    return super.onDragEvent(event);
}
 
开发者ID:nichollyn,项目名称:amddviews,代码行数:24,代码来源:DropableListView.java

示例12: onDragEvent

@Override
public boolean onDragEvent(DragEvent event) {
    switch (event.getAction()) {
    case DragEvent.ACTION_DRAG_STARTED:
        //Log.i(TAG, "DropGV Drag Started.");
        return onDragStarted(event);
    case DragEvent.ACTION_DRAG_ENTERED:
        Log.i(TAG, "Drag entered DropGV.");
        return onDragEntered(event);
    case DragEvent.ACTION_DRAG_LOCATION:
        return onDragMoveOn(event);
    case DragEvent.ACTION_DRAG_EXITED:
        Log.i(TAG, "Drag exited DropGV");
        return onDragExited(event);
    case DragEvent.ACTION_DROP:
        Log.i(TAG, "Drag droped DropGV");
        return onDrop(event);
    case DragEvent.ACTION_DRAG_ENDED:
        //Log.i(TAG, "Drag ended DropGV.");
        return onDragEnded(event);
    }

    return super.onDragEvent(event);
}
 
开发者ID:nichollyn,项目名称:amddviews,代码行数:24,代码来源:DropableGridView.java

示例13: onDrag

public boolean onDrag(View v, DragEvent event) {
    int action = event.getAction();
    switch (event.getAction()) {
        case DragEvent.ACTION_DRAG_STARTED:
            v.setBackgroundColor(LIGHT_BLUE);
            v.invalidate();
            return true;
        case DragEvent.ACTION_DRAG_ENTERED:
            v.setBackgroundColor(LIGHT_GREEN);
            v.invalidate();
            return true;
        case DragEvent.ACTION_DRAG_EXITED:
            v.setBackgroundColor(LIGHT_BLUE);
            v.invalidate();
            return true;
        case DragEvent.ACTION_DRAG_ENDED:
            v.setBackgroundColor(Color.WHITE);
            v.invalidate();
            return true;
        case DragEvent.ACTION_DROP:
            // Dropped, reassign Tile to the target Layout
            LetterTile tile = (LetterTile) event.getLocalState();
            tile.moveToViewGroup((ViewGroup) v);
            if (stackedLayout.empty()) {
                TextView messageBox = (TextView) findViewById(R.id.message_box);
                messageBox.setText(word1 + " " + word2);
            }
            /**
             **
             **  YOUR CODE GOES HERE
             **
             **/
            return true;
    }
    return false;
}
 
开发者ID:bricam,项目名称:wordstack,代码行数:36,代码来源:MainActivity.java

示例14: onDrag

@Override
public boolean onDrag(View v, DragEvent event) {
	switch (event.getAction()) {
	case DragEvent.ACTION_DRAG_STARTED:
		// Do nothing
		break;
	case DragEvent.ACTION_DRAG_ENTERED:
		v.setAlpha(0.5F);
		break;
	case DragEvent.ACTION_DRAG_EXITED:
		v.setAlpha(1F);
		break;
	case DragEvent.ACTION_DROP:
		View view = (View) event.getLocalState();
		View item = (View) view.getParent().getParent();
		for (int i = 0, j = videosScroll.getChildCount(); i < j; i++) {
			if (videosScroll.getChildAt(i).findViewById(R.id.editor_image) == v) {
				// 当前位置
				videosScroll.removeView(item);
				videosScroll.addView(item, i);
				break;
			}
		}
		RefreshVideosScroll(true);
		break;
	case DragEvent.ACTION_DRAG_ENDED:
		v.setAlpha(1F);
	default:
		break;
	}
	return true;
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:32,代码来源:HoDragVideo.java

示例15: onDrag

@Override
public boolean onDrag(View v, DragEvent event) {
    switch(event.getAction()) {
        case DragEvent.ACTION_DRAG_STARTED:
            onDropListener.onDragStarted();
            return true;

        case DragEvent.ACTION_DRAG_ENTERED:
            return true;

        case DragEvent.ACTION_DRAG_LOCATION:
            // Ignore the event
            onDropListener.onDragLocation(event.getX(), event.getY());
            return true;

        case DragEvent.ACTION_DRAG_EXITED:
            return true;

        case DragEvent.ACTION_DROP:
            onDropListener.onDrop();
            return true;

        case DragEvent.ACTION_DRAG_ENDED:
            onDropListener.onDragEnded();
            return true;

        default:
            break;
    }

    return false;
}
 
开发者ID:dmallcott,项目名称:DismissibleImageView,代码行数:32,代码来源:DismissibleOnDragListener.java


注:本文中的android.view.DragEvent.ACTION_DRAG_ENDED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。