本文整理匯總了Java中com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL屬性的典型用法代碼示例。如果您正苦於以下問題:Java CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL屬性的具體用法?Java CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL怎麽用?Java CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.h6ah4i.android.widget.advrecyclerview.utils.CustomRecyclerViewUtils
的用法示例。
在下文中一共展示了CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startDragging
@SuppressWarnings("unchecked")
private void startDragging(RecyclerView rv, MotionEvent e, RecyclerView.ViewHolder holder, ItemDraggableRange range) {
safeEndAnimation(rv, holder);
mHandler.cancelLongPressDetection();
mDraggingItemInfo = new DraggingItemInfo(holder, mLastTouchX, mLastTouchY);
mDraggingItemViewHolder = holder;
// XXX if setIsRecyclable() is used, another view holder objects will be created
// which has the same ID with currently dragging item... Not works as expected.
// holder.setIsRecyclable(false);
mDraggableRange = range;
mOrigOverScrollMode = ViewCompat.getOverScrollMode(rv);
ViewCompat.setOverScrollMode(rv, ViewCompat.OVER_SCROLL_NEVER);
mLastTouchX = (int) (e.getX() + 0.5f);
mLastTouchY = (int) (e.getY() + 0.5f);
// disable auto scrolling until user moves the item
mDragStartTouchY = mDragMinTouchY = mDragMaxTouchY = mLastTouchY;
mDragStartTouchX = mDragMinTouchX = mDragMaxTouchX = mLastTouchX;
mScrollDirMask = SCROLL_DIR_NONE;
mRecyclerView.getParent().requestDisallowInterceptTouchEvent(true);
startScrollOnDraggingProcess();
// raise onDragItemStarted() event
mAdapter.onDragItemStarted(mDraggingItemInfo, holder, mDraggableRange);
// setup decorators
mAdapter.onBindViewHolder(holder, holder.getLayoutPosition());
mDraggingItemDecorator = new DraggingItemDecorator(mRecyclerView, holder, mDraggableRange);
mDraggingItemDecorator.setShadowDrawable(mShadowDrawable);
mDraggingItemDecorator.start(e, mDraggingItemInfo);
int layoutType = CustomRecyclerViewUtils.getLayoutType(mRecyclerView);
if (supportsViewTranslation() &&
(layoutType == CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_VERTICAL ||
layoutType == CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL)) {
mSwapTargetItemOperator = new SwapTargetItemOperator(mRecyclerView, holder, mDraggableRange, mDraggingItemInfo);
mSwapTargetItemOperator.setSwapTargetTranslationInterpolator(mSwapTargetTranslationInterpolator);
mSwapTargetItemOperator.start();
mSwapTargetItemOperator.update(mDraggingItemDecorator.getDraggingItemTranslationX(), mDraggingItemDecorator.getDraggingItemTranslationY());
}
if (mEdgeEffectDecorator != null) {
mEdgeEffectDecorator.reorderToTop();
}
if (mItemDragEventListener != null) {
mItemDragEventListener.onItemDragStarted(mAdapter.getDraggingItemInitialPosition());
}
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:60,代碼來源:RecyclerViewDragDropManager.java
示例2: findSwapTargetItem
static RecyclerView.ViewHolder findSwapTargetItem(
RecyclerView rv, RecyclerView.ViewHolder draggingItem,
DraggingItemInfo draggingItemInfo, int overlayItemLeft, int overlayItemTop, ItemDraggableRange range) {
RecyclerView.ViewHolder swapTargetHolder = null;
if ((draggingItem == null) || (
draggingItem.getAdapterPosition() != RecyclerView.NO_POSITION &&
draggingItem.getItemId() == draggingItemInfo.id)) {
final int layoutType = CustomRecyclerViewUtils.getLayoutType(rv);
final boolean isVerticalLayout =
(CustomRecyclerViewUtils.extractOrientation(layoutType) == CustomRecyclerViewUtils.ORIENTATION_VERTICAL);
if (isVerticalLayout) {
overlayItemLeft = Math.max(overlayItemLeft, rv.getPaddingLeft());
overlayItemLeft = Math.min(overlayItemLeft, Math.max(0, rv.getWidth() - rv.getPaddingRight() - draggingItemInfo.width));
} else {
overlayItemTop = Math.max(overlayItemTop, rv.getPaddingTop());
overlayItemTop = Math.min(overlayItemTop, Math.max(0, rv.getHeight() - rv.getPaddingBottom() - draggingItemInfo.height));
}
switch (layoutType) {
case CustomRecyclerViewUtils.LAYOUT_TYPE_GRID_HORIZONTAL:
case CustomRecyclerViewUtils.LAYOUT_TYPE_GRID_VERTICAL:
swapTargetHolder = findSwapTargetItemForGridLayoutManager(
rv, draggingItem, draggingItemInfo, overlayItemLeft, overlayItemTop, range, isVerticalLayout);
break;
case CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_HORIZONTAL:
swapTargetHolder = findSwapTargetItemForLinearLayoutManagerHorizontal(rv, draggingItem, draggingItemInfo, overlayItemLeft, overlayItemTop, range);
break;
case CustomRecyclerViewUtils.LAYOUT_TYPE_LINEAR_VERTICAL:
swapTargetHolder = findSwapTargetItemForLinearLayoutManagerVertical(rv, draggingItem, draggingItemInfo, overlayItemLeft, overlayItemTop, range);
break;
default:
break;
}
}
// check range
if (swapTargetHolder != null && range != null) {
if (!range.checkInRange(swapTargetHolder.getAdapterPosition())) {
swapTargetHolder = null;
}
}
return swapTargetHolder;
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:47,代碼來源:RecyclerViewDragDropManager.java