public void finish() { if (mStarted) { mRecyclerView.removeItemDecoration(this); } releaseBothGlows(); mRecyclerView = null; mStarted = false; }
private void finish() { mRecyclerView.removeItemDecoration(this); postInvalidateOnAnimation(); // this is required to avoid remnant of the decoration mRecyclerView = null; mSwipingItem = null; mTranslationY = 0; mMoveAnimationInterpolator = null; }
public void reorderToTop() { if (mStarted) { mRecyclerView.removeItemDecoration(this); mRecyclerView.addItemDecoration(this); } } }
private void destroyCallbacks() { mRecyclerView.removeItemDecoration(this); mRecyclerView.removeOnItemTouchListener(mOnItemTouchListener); mRecyclerView.removeOnChildAttachStateChangeListener(this); // clean all attached final int recoverAnimSize = mRecoverAnimations.size(); for (int i = recoverAnimSize - 1; i >= 0; i--) { final RecoverAnimation recoverAnimation = mRecoverAnimations.get(0); mCallback.clearView(mRecyclerView, recoverAnimation.mViewHolder); } mRecoverAnimations.clear(); mOverdrawChild = null; mOverdrawChildPosition = -1; releaseVelocityTracker(); stopGestureDetection(); }
public void finish(boolean animate) { if (mStarted) { mRecyclerView.removeItemDecoration(this);
public void finish(boolean animate) { if (mStarted) { mRecyclerView.removeItemDecoration(this); } final RecyclerView.ItemAnimator itemAnimator = mRecyclerView.getItemAnimator(); if (itemAnimator != null) { itemAnimator.endAnimations(); } mRecyclerView.stopScroll(); if (mSwapTargetItem != null) { // return to default position updateSwapTargetTranslation(mDraggingItemViewHolder, mSwapTargetItem, mCurTranslationPhase); moveToDefaultPosition(mSwapTargetItem.itemView, 1.0f, 1.0f, 0.0f, 1.0f, animate); mSwapTargetItem = null; } mDraggingItemViewHolder = null; mTranslationX = 0; mTranslationY = 0; mCurTranslationPhase = 0.0f; mReqTranslationPhase = 0.0f; mStarted = false; mDraggingItemInfo = null; }
private void setItemDecoration(int columns) { if (itemOffsetDecoration != null) { recyclerView.removeItemDecoration(itemOffsetDecoration); } itemOffsetDecoration = new GridSpacingItemDecoration( columns, context.getResources().getDimensionPixelSize(R.dimen.ef_item_padding), false ); recyclerView.addItemDecoration(itemOffsetDecoration); layoutManager.setSpanCount(columns); }
private void setItemDecoration(int columns) { if (itemOffsetDecoration != null) { recyclerView.removeItemDecoration(itemOffsetDecoration); } itemOffsetDecoration = new GridSpacingItemDecoration(columns, context.getResources().getDimensionPixelSize(R.dimen.imagepicker_item_padding), false ); recyclerView.addItemDecoration(itemOffsetDecoration); layoutManager.setSpanCount(columns); }
public final void recreateAdapter() { if (mItemDecoration != null) mRecyclerView.removeItemDecoration(mItemDecoration); mAdapter = createAdapter(); mRecyclerView.setAdapter(mAdapter); mItemDecoration = mAdapter.createItemDecoration(); mRecyclerView.addItemDecoration(mItemDecoration); }
/** * Attaches {@link DragDropHelper} to {@code recyclerView}. If already attached to a {@link RecyclerView}, it * detaches from the previous one. If {@code null} is provided, it detaches from the current {@link RecyclerView}. * * {@link DragDropHelper} uses {@link RecyclerView.ItemDecoration}, {@link RecyclerView.OnItemTouchListener} and * {@link RecyclerView.OnChildAttachStateChangeListener} internally, which are set or removed here. */ public void attach(@Nullable RecyclerView recyclerView, @NonNull Callback callback) { if (mRecyclerView != recyclerView) { if (mRecyclerView != null) { mRecyclerView.removeItemDecoration(this); mRecyclerView.removeOnItemTouchListener(this); mRecyclerView.removeOnChildAttachStateChangeListener(this); } mRecyclerView = recyclerView; if (mRecyclerView != null) { mScrollSpeedMax = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, SCROLL_SPEED_MAX_DP, mRecyclerView.getResources().getDisplayMetrics()); mRecyclerView.addItemDecoration(this, 0); mRecyclerView.addOnItemTouchListener(this); mRecyclerView.addOnChildAttachStateChangeListener(this); } } mCallback = callback; }