@Test public void testOnDrawHorizontally() { this.testOnDrawHorizontallyInner(false, false); }
protected void onDrawHorizontally(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state) { canvas.save(); int top; int bottom; if (parent.getClipToPadding()) { top = parent.getPaddingTop(); bottom = parent.getHeight() - parent.getPaddingBottom(); canvas.clipRect( parent.getPaddingLeft(), top, parent.getWidth() - parent.getPaddingRight(), bottom ); } else { top = 0; bottom = parent.getHeight(); } top += dividerOffsetStart; bottom -= dividerOffsetEnd; final int childCount = parent.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if ((skipFirst && childIndex == 0) || (skipLast && childIndex == childCount - 1)) { continue; } final View child = parent.getChildAt(childIndex); if (precondition.check(child, parent, state)) { parent.getDecoratedBoundsWithMargins(child, bounds); final int right = bounds.right + Math.round(child.getTranslationX()); final int left = right - dividerThickness; divider.setBounds(left, top, right, bottom); divider.draw(canvas); } } canvas.restore(); }
ItemDividerDecoration extends RecyclerViewItemDecoration { protected void onDrawHorizontally(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state) { canvas.save(); int top; int bottom; if (parent.getClipToPadding()) { top = parent.getPaddingTop(); bottom = parent.getHeight() - parent.getPaddingBottom(); canvas.clipRect( parent.getPaddingLeft(), top, parent.getWidth() - parent.getPaddingRight(), bottom ); } else { top = 0; bottom = parent.getHeight(); } top += dividerOffsetStart; bottom -= dividerOffsetEnd; final int childCount = parent.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if ((skipFirst && childIndex == 0) || (skipLast && childIndex == childCount - 1)) { continue; } final View child = parent.getChildAt(childIndex); if (precondition.check(child, parent, state)) { parent.getDecoratedBoundsWithMargins(child, bounds); final int right = bounds.right + Math.round(child.getTranslationX()); final int left = right - dividerThickness; divider.setBounds(left, top, right, bottom); divider.draw(canvas); } } canvas.restore(); } }
ItemDividerDecoration extends RecyclerViewItemDecoration { protected void onDrawHorizontally(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state) { canvas.save(); int top; int bottom; if (parent.getClipToPadding()) { top = parent.getPaddingTop(); bottom = parent.getHeight() - parent.getPaddingBottom(); canvas.clipRect( parent.getPaddingLeft(), top, parent.getWidth() - parent.getPaddingRight(), bottom ); } else { top = 0; bottom = parent.getHeight(); } top += dividerOffsetStart; bottom -= dividerOffsetEnd; final int childCount = parent.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if ((skipFirst && childIndex == 0) || (skipLast && childIndex == childCount - 1)) { continue; } final View child = parent.getChildAt(childIndex); if (precondition.check(child, parent, state)) { parent.getDecoratedBoundsWithMargins(child, bounds); final int right = bounds.right + Math.round(child.getTranslationX()); final int left = right - dividerThickness; divider.setBounds(left, top, right, bottom); divider.draw(canvas); } } canvas.restore(); } ItemDividerDecoration();  ItemDividerDecoration(@Orientation final int orientation, @NonNull final Drawable divider);  ItemDividerDecoration(@Nullable final Context context);  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs);  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs, @AttrRes final int defStyleAttr); @SuppressWarnings("ResourceType")  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs, @AttrRes final int defStyleAttr, @StyleRes final int defStyleRes); }
ItemDividerDecoration extends RecyclerViewItemDecoration { protected void onDrawHorizontally(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state) { canvas.save(); int top; int bottom; if (parent.getClipToPadding()) { top = parent.getPaddingTop(); bottom = parent.getHeight() - parent.getPaddingBottom(); canvas.clipRect( parent.getPaddingLeft(), top, parent.getWidth() - parent.getPaddingRight(), bottom ); } else { top = 0; bottom = parent.getHeight(); } top += dividerOffsetStart; bottom -= dividerOffsetEnd; final int childCount = parent.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if ((skipFirst && childIndex == 0) || (skipLast && childIndex == childCount - 1)) { continue; } final View child = parent.getChildAt(childIndex); if (precondition.check(child, parent, state)) { parent.getDecoratedBoundsWithMargins(child, bounds); final int right = bounds.right + Math.round(child.getTranslationX()); final int left = right - dividerThickness; divider.setBounds(left, top, right, bottom); divider.draw(canvas); } } canvas.restore(); } ItemDividerDecoration();  ItemDividerDecoration(@Orientation final int orientation, @NonNull final Drawable divider);  ItemDividerDecoration(@Nullable final Context context);  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs);  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs, @AttrRes final int defStyleAttr); @SuppressWarnings("ResourceType")  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs, @AttrRes final int defStyleAttr, @StyleRes final int defStyleRes); void setOrientation(@Orientation final int orientation); @Orientation int getOrientation(); void setDivider(@Nullable final Drawable divider); @Nullable Drawable getDivider(); void setDividerThickness(@IntRange(from = 0) final int thickness); @IntRange(from = 0) int getDividerThickness(); void setDividerOffset(@IntRange(from = 0) final int start, @IntRange(from = 0) final int end); int getDividerOffsetStart(); int getDividerOffsetEnd(); @Override void getItemOffsets(@NonNull final Rect rect, @NonNull final View view, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state); @Override void onDraw(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state); }
ItemDividerDecoration extends RecyclerViewItemDecoration { protected void onDrawHorizontally(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state) { canvas.save(); int top; int bottom; if (parent.getClipToPadding()) { top = parent.getPaddingTop(); bottom = parent.getHeight() - parent.getPaddingBottom(); canvas.clipRect( parent.getPaddingLeft(), top, parent.getWidth() - parent.getPaddingRight(), bottom ); } else { top = 0; bottom = parent.getHeight(); } top += dividerOffsetStart; bottom -= dividerOffsetEnd; final int childCount = parent.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if ((skipFirst && childIndex == 0) || (skipLast && childIndex == childCount - 1)) { continue; } final View child = parent.getChildAt(childIndex); if (precondition.check(child, parent, state)) { parent.getDecoratedBoundsWithMargins(child, bounds); final int right = bounds.right + Math.round(child.getTranslationX()); final int left = right - dividerThickness; divider.setBounds(left, top, right, bottom); divider.draw(canvas); } } canvas.restore(); } ItemDividerDecoration();  ItemDividerDecoration(@Orientation final int orientation, @NonNull final Drawable divider);  ItemDividerDecoration(@Nullable final Context context);  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs);  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs, @AttrRes final int defStyleAttr); @SuppressWarnings("ResourceType")  ItemDividerDecoration(@Nullable final Context context, @Nullable final AttributeSet attrs, @AttrRes final int defStyleAttr, @StyleRes final int defStyleRes); void setOrientation(@Orientation final int orientation); @Orientation int getOrientation(); void setDivider(@Nullable final Drawable divider); @Nullable Drawable getDivider(); void setDividerThickness(@IntRange(from = 0) final int thickness); @IntRange(from = 0) int getDividerThickness(); void setDividerOffset(@IntRange(from = 0) final int start, @IntRange(from = 0) final int end); int getDividerOffsetStart(); int getDividerOffsetEnd(); @Override void getItemOffsets(@NonNull final Rect rect, @NonNull final View view, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state); @Override void onDraw(@NonNull final Canvas canvas, @NonNull final RecyclerView parent, @NonNull final RecyclerView.State state); static final int HORIZONTAL; static final int VERTICAL; }