decoratedLeft = lm.getDecoratedLeft(child) + (int) child.getTranslationX(); decoratedTop = lm.getDecoratedTop(child) + (int) child.getTranslationY(); decoratedRight = lm.getDecoratedRight(child) + (int) child.getTranslationX();
lm.getDecoratedLeft(child), lm.getDecoratedTop(child), lm.getDecoratedRight(child), lm.getDecoratedLeft(child) + child.getTranslationX(), top, child.getLeft() + child.getTranslationX(), lm.getDecoratedLeft(child) + child.getTranslationY(), bottom, right,
@Override public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) { if (parent.isAnimating()) return; final int childCount = parent.getChildCount(); final RecyclerView.LayoutManager lm = parent.getLayoutManager(); for (int i = 0; i < childCount; i++) { final View child = parent.getChildAt(i); RecyclerView.ViewHolder viewHolder = parent.getChildViewHolder(child); if (viewHolder instanceof Divided) { final int right = lm.getDecoratedRight(child); final int bottom = lm.getDecoratedBottom(child); // draw the bottom divider canvas.drawRect(lm.getDecoratedLeft(child), bottom - dividerSize, right, bottom, paint); // draw the right edge divider canvas.drawRect(right - dividerSize, lm.getDecoratedTop(child), right, bottom - dividerSize, paint); } } }
private void retrieveItemPosition(final RecyclerView.ViewHolder holder) { mDeltaX = mRecyclerView.getWidth() - mRecyclerView.getLayoutManager().getDecoratedLeft(holder.itemView); }
private void retrieveItemPosition(final RecyclerView.ViewHolder holder) { mDeltaX = mRecyclerView.getWidth() - mRecyclerView.getLayoutManager().getDecoratedLeft(holder.itemView); }
final int minLeft = layoutManager.getDecoratedLeft(target.itemView); if (minLeft <= recyclerView.getPaddingLeft()) { recyclerView.scrollToPosition(toPos);
@Override public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { for (int i = 0; i < parent.getChildCount(); i++) { View child = parent.getChildAt(i); if (!isHeader(child, parent)) continue; RecyclerView.LayoutManager lm = parent.getLayoutManager(); float top = lm.getDecoratedTop(child) + child.getTranslationY(); float bottom = lm.getDecoratedBottom(child) + child.getTranslationY(); if (i == parent.getChildCount() - 1) { // Draw to bottom if last item bottom = Math.max(parent.getHeight(), bottom); } float right = lm.getDecoratedRight(child) + child.getTranslationX(); float left = lm.getDecoratedLeft(child) + child.getTranslationX(); c.drawRect(left, top, right, bottom, paint); } } }