@@ -0,0 +1,3282 @@
+package com.monmonja.library.decorators;%0A%0Aimport android.content.Context;%0Aimport android.content.res.TypedArray;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Rect;%0Aimport android.graphics.drawable.Drawable;%0Aimport android.support.v7.widget.LinearLayoutManager;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.View;%0A%0A/**%0A * Created by almondjoseph on 4/4/15.%0A *%0A * https://gist.github.com/alexfu/0f464fc3742f134ccd1e%0A */%0Apublic class DividerItemDecoration extends RecyclerView.ItemDecoration %7B%0A%0A    private static final int%5B%5D ATTRS = new int%5B%5D%7B%0A            android.R.attr.listDivider%0A    %7D;%0A%0A    public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;%0A%0A    public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;%0A%0A    private Drawable mDivider;%0A%0A    private int mOrientation;%0A%0A    public DividerItemDecoration(Context context, int orientation) %7B%0A        final TypedArray a = context.obtainStyledAttributes(ATTRS);%0A        mDivider = a.getDrawable(0);%0A        a.recycle();%0A        setOrientation(orientation);%0A    %7D%0A%0A    public void setOrientation(int orientation) %7B%0A        if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) %7B%0A            throw new IllegalArgumentException(%22invalid orientation%22);%0A        %7D%0A        mOrientation = orientation;%0A    %7D%0A%0A    @Override%0A    public void onDraw(Canvas c, RecyclerView parent) %7B%0A        if (mOrientation == VERTICAL_LIST) %7B%0A            drawVertical(c, parent);%0A        %7D else %7B%0A            drawHorizontal(c, parent);%0A        %7D%0A    %7D%0A%0A    public void drawVertical(Canvas c, RecyclerView parent) %7B%0A        final int left = parent.getPaddingLeft();%0A        final int right = parent.getWidth() - parent.getPaddingRight();%0A%0A        final int childCount = parent.getChildCount();%0A        for (int i = 0; i %3C childCount; i++) %7B%0A            final View child = parent.getChildAt(i);%0A            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child%0A                    .getLayoutParams();%0A            final int top = child.getBottom() + params.bottomMargin;%0A            final int bottom = top + mDivider.getIntrinsicHeight();%0A            mDivider.setBounds(left, top, right, bottom);%0A            mDivider.draw(c);%0A        %7D%0A    %7D%0A%0A    public void drawHorizontal(Canvas c, RecyclerView parent) %7B%0A        final int top = parent.getPaddingTop();%0A        final int bottom = parent.getHeight() - parent.getPaddingBottom();%0A%0A        final int childCount = parent.getChildCount();%0A        for (int i = 0; i %3C childCount; i++) %7B%0A            final View child = parent.getChildAt(i);%0A            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child%0A                    .getLayoutParams();%0A            final int left = child.getRight() + params.rightMargin;%0A            final int right = left + mDivider.getIntrinsicHeight();%0A            mDivider.setBounds(left, top, right, bottom);%0A            mDivider.draw(c);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) %7B%0A        if (mOrientation == VERTICAL_LIST) %7B%0A            outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());%0A        %7D else %7B%0A            outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);%0A        %7D%0A    %7D%0A%7D

add new drawable, fix bugs