List of usage examples for android.content ClipData newUri
static public ClipData newUri(ContentResolver resolver, CharSequence label, Uri uri)
From source file:com.tct.mail.browse.ConversationItemView.java
/** * Begin drag mode. Keep the conversation selected (NOT toggle selection) and start drag. *///from ww w.ja v a 2 s . c om private boolean beginDragMode() { if (mLastTouchX < 0 || mLastTouchY < 0 || mSelectedConversationSet == null) { return false; } // If this is already checked, don't bother unchecking it! if (!mSelected) { toggleSelectedState(); } // Clip data has form: [conversations_uri, conversationId1, // maxMessageId1, label1, conversationId2, maxMessageId2, label2, ...] final int count = mSelectedConversationSet.size(); String description = Utils.formatPlural(mContext, R.plurals.move_conversation, count); final ClipData data = ClipData.newUri(mContext.getContentResolver(), description, Conversation.MOVE_CONVERSATIONS_URI); for (Conversation conversation : mSelectedConversationSet.values()) { data.addItem(new Item(String.valueOf(conversation.position))); } // Protect against non-existent views: only happens for monkeys final int width = this.getWidth(); final int height = this.getHeight(); final boolean isDimensionNegative = (width < 0) || (height < 0); if (isDimensionNegative) { LogUtils.e(LOG_TAG, "ConversationItemView: dimension is negative: " + "width=%d, height=%d", width, height); return false; } mActivity.startDragMode(); // Start drag mode startDrag(data, new ShadowBuilder(this, count, mLastTouchX, mLastTouchY), null, 0); return true; }