1180360409c9e4e9163c670ff48663244b4057eafMaurice Lam/*
2180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * Copyright (C) 2015 The Android Open Source Project
3180360409c9e4e9163c670ff48663244b4057eafMaurice Lam *
4180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * Licensed under the Apache License, Version 2.0 (the "License");
5180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * you may not use this file except in compliance with the License.
6180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * You may obtain a copy of the License at
7180360409c9e4e9163c670ff48663244b4057eafMaurice Lam *
8180360409c9e4e9163c670ff48663244b4057eafMaurice Lam *      http://www.apache.org/licenses/LICENSE-2.0
9180360409c9e4e9163c670ff48663244b4057eafMaurice Lam *
10180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * Unless required by applicable law or agreed to in writing, software
11180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * distributed under the License is distributed on an "AS IS" BASIS,
12180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * See the License for the specific language governing permissions and
14180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * limitations under the License.
15180360409c9e4e9163c670ff48663244b4057eafMaurice Lam */
16180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
17180360409c9e4e9163c670ff48663244b4057eafMaurice Lampackage com.android.setupwizardlib;
18180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
19180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.content.Context;
20180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.content.res.TypedArray;
21180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.graphics.Canvas;
22180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.graphics.Rect;
23180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.graphics.drawable.Drawable;
24efd346d200a1649d94c5a1add1636de5b7d56eefUdam Sainiimport android.support.annotation.IntDef;
25180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.support.v4.view.ViewCompat;
26180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.support.v7.widget.RecyclerView;
27180360409c9e4e9163c670ff48663244b4057eafMaurice Lamimport android.view.View;
28180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
29efd346d200a1649d94c5a1add1636de5b7d56eefUdam Sainiimport java.lang.annotation.Retention;
30efd346d200a1649d94c5a1add1636de5b7d56eefUdam Sainiimport java.lang.annotation.RetentionPolicy;
31efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini
32180360409c9e4e9163c670ff48663244b4057eafMaurice Lam/**
33180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * An {@link android.support.v7.widget.RecyclerView.ItemDecoration} for RecyclerView to draw
34180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * dividers between items. This ItemDecoration will draw the drawable specified by
35180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * {@link #setDivider(android.graphics.drawable.Drawable)} as the divider in between each item by
36180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * default, and the behavior of whether the divider is shown can be customized by subclassing
37180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * {@link com.android.setupwizardlib.DividerItemDecoration.DividedViewHolder}.
38180360409c9e4e9163c670ff48663244b4057eafMaurice Lam *
39180360409c9e4e9163c670ff48663244b4057eafMaurice Lam * <p>Modified from v14 PreferenceFragment.DividerDecoration, added with inset capabilities.
40180360409c9e4e9163c670ff48663244b4057eafMaurice Lam */
41180360409c9e4e9163c670ff48663244b4057eafMaurice Lampublic class DividerItemDecoration extends RecyclerView.ItemDecoration {
42180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
43180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    /* static section */
44180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
45180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public interface DividedViewHolder {
46180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
47180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        /**
48180360409c9e4e9163c670ff48663244b4057eafMaurice Lam         * Returns whether divider is allowed above this item. A divider will be shown only if both
49180360409c9e4e9163c670ff48663244b4057eafMaurice Lam         * items immediately above and below it allows this divider.
50180360409c9e4e9163c670ff48663244b4057eafMaurice Lam         */
51180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        boolean isDividerAllowedAbove();
52180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
53180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        /**
54180360409c9e4e9163c670ff48663244b4057eafMaurice Lam         * Returns whether divider is allowed below this item. A divider will be shown only if both
55180360409c9e4e9163c670ff48663244b4057eafMaurice Lam         * items immediately above and below it allows this divider.
56180360409c9e4e9163c670ff48663244b4057eafMaurice Lam         */
57180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        boolean isDividerAllowedBelow();
58180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
59180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
60efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    @Retention(RetentionPolicy.SOURCE)
61efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    @IntDef({
62efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini            DIVIDER_CONDITION_EITHER,
63efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini            DIVIDER_CONDITION_BOTH})
64efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    public @interface DividerCondition {}
65efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini
66efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    public static final int DIVIDER_CONDITION_EITHER = 0;
67efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    public static final int DIVIDER_CONDITION_BOTH = 1;
68180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
69180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    /**
70325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * @deprecated Use {@link #DividerItemDecoration(android.content.Context)}
71180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     */
72325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    @Deprecated
73180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public static DividerItemDecoration getDefault(Context context) {
74325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        return new DividerItemDecoration(context);
75325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    }
76325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam
77325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    /* non-static section */
78325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam
79325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    private Drawable mDivider;
80325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    private int mDividerHeight;
81325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    private int mDividerIntrinsicHeight;
82325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    @DividerCondition
83325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    private int mDividerCondition;
84325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam
85325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    public DividerItemDecoration() {
86325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    }
87325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam
88325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    public DividerItemDecoration(Context context) {
89efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        final TypedArray a = context.obtainStyledAttributes(R.styleable.SuwDividerItemDecoration);
90efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        final Drawable divider = a.getDrawable(
91efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini                R.styleable.SuwDividerItemDecoration_android_listDivider);
92efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        final int dividerHeight = a.getDimensionPixelSize(
93efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini                R.styleable.SuwDividerItemDecoration_android_dividerHeight, 0);
94efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        @DividerCondition final int dividerCondition = a.getInt(
95efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini                R.styleable.SuwDividerItemDecoration_suwDividerCondition,
96efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini                DIVIDER_CONDITION_EITHER);
97180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        a.recycle();
98180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
99325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        setDivider(divider);
100325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        setDividerHeight(dividerHeight);
101325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        setDividerCondition(dividerCondition);
102180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
103180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
104180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    @Override
105180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
106180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        if (mDivider == null) {
107180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            return;
108180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        }
109180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        final int childCount = parent.getChildCount();
110180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        final int width = parent.getWidth();
111180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        final int dividerHeight = mDividerHeight != 0 ? mDividerHeight : mDividerIntrinsicHeight;
112180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        for (int childViewIndex = 0; childViewIndex < childCount; childViewIndex++) {
113180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            final View view = parent.getChildAt(childViewIndex);
114180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            if (shouldDrawDividerBelow(view, parent)) {
115180360409c9e4e9163c670ff48663244b4057eafMaurice Lam                final int top = (int) ViewCompat.getY(view) + view.getHeight();
116180360409c9e4e9163c670ff48663244b4057eafMaurice Lam                mDivider.setBounds(0, top, width, top + dividerHeight);
117180360409c9e4e9163c670ff48663244b4057eafMaurice Lam                mDivider.draw(c);
118180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            }
119180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        }
120180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
121180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
122180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    @Override
123180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
124180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            RecyclerView.State state) {
125180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        if (shouldDrawDividerBelow(view, parent)) {
126180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            outRect.bottom = mDividerHeight != 0 ? mDividerHeight : mDividerIntrinsicHeight;
127180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        }
128180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
129180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
130180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    private boolean shouldDrawDividerBelow(View view, RecyclerView parent) {
131180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        final RecyclerView.ViewHolder holder = parent.getChildViewHolder(view);
132e860e77e9f218f094495692eb1180848dfebc481Maurice Lam        final int index = holder.getLayoutPosition();
133e860e77e9f218f094495692eb1180848dfebc481Maurice Lam        final int lastItemIndex = parent.getAdapter().getItemCount() - 1;
134325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        if (isDividerAllowedBelow(holder)) {
135325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            if (mDividerCondition == DIVIDER_CONDITION_EITHER) {
136325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam                // Draw the divider without consulting the next item if we only
137325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam                // need permission for either above or below.
138325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam                return true;
139efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini            }
140325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        } else if (mDividerCondition == DIVIDER_CONDITION_BOTH || index == lastItemIndex) {
141325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            // Don't draw if the current view holder doesn't allow drawing below
142325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            // and the current theme requires permission for both the item below and above.
143325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            // Also, if this is the last item, there is no item below to ask permission
144325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            // for whether to draw a divider above, so don't draw it.
145325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            return false;
146efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        }
147efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        // Require permission from index below to draw the divider.
148180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        if (index < lastItemIndex) {
149e860e77e9f218f094495692eb1180848dfebc481Maurice Lam            final RecyclerView.ViewHolder nextHolder =
150e860e77e9f218f094495692eb1180848dfebc481Maurice Lam                    parent.findViewHolderForLayoutPosition(index + 1);
151325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam            if (!isDividerAllowedAbove(nextHolder)) {
152180360409c9e4e9163c670ff48663244b4057eafMaurice Lam                // Don't draw if the next view holder doesn't allow drawing above
153180360409c9e4e9163c670ff48663244b4057eafMaurice Lam                return false;
154180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            }
155180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        }
156180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        return true;
157180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
158180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
159180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    /**
160325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * Whether a divider is allowed above the view holder. The allowed values will be combined
161325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * according to {@link #getDividerCondition()}. The default implementation delegates to
162325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * {@link com.android.setupwizardlib.DividerItemDecoration.DividedViewHolder}, or simply allows
163325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * the divider if the view holder doesn't implement {@code DividedViewHolder}. Subclasses can
164325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * override this to give more information to decide whether a divider should be drawn.
165325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     *
166325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * @return True if divider is allowed above this view holder.
167325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     */
168325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    protected boolean isDividerAllowedAbove(RecyclerView.ViewHolder viewHolder) {
169325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        return !(viewHolder instanceof DividedViewHolder)
170325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam                || ((DividedViewHolder) viewHolder).isDividerAllowedAbove();
171325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    }
172325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam
173325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    /**
174325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * Whether a divider is allowed below the view holder. The allowed values will be combined
175325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * according to {@link #getDividerCondition()}. The default implementation delegates to
176325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * {@link com.android.setupwizardlib.DividerItemDecoration.DividedViewHolder}, or simply allows
177325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * the divider if the view holder doesn't implement {@code DividedViewHolder}. Subclasses can
178325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * override this to give more information to decide whether a divider should be drawn.
179325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     *
180325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     * @return True if divider is allowed below this view holder.
181325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam     */
182325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    protected boolean isDividerAllowedBelow(RecyclerView.ViewHolder viewHolder) {
183325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam        return !(viewHolder instanceof DividedViewHolder)
184325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam                || ((DividedViewHolder) viewHolder).isDividerAllowedBelow();
185325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    }
186325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam
187325b78cfbd0d7366771ee81838bc444c69e39963Maurice Lam    /**
188180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     * Sets the drawable to be used as the divider.
189180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     */
190180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public void setDivider(Drawable divider) {
191180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        if (divider != null) {
192180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            mDividerIntrinsicHeight = divider.getIntrinsicHeight();
193180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        } else {
194180360409c9e4e9163c670ff48663244b4057eafMaurice Lam            mDividerIntrinsicHeight = 0;
195180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        }
196180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        mDivider = divider;
197180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
198180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
199180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    /**
200180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     * Gets the drawable currently used as the divider.
201180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     */
202180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public Drawable getDivider() {
203180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        return mDivider;
204180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
205180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
206180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    /**
207180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     * Sets the divider height, in pixels.
208180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     */
209180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public void setDividerHeight(int dividerHeight) {
210180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        mDividerHeight = dividerHeight;
211180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
212180360409c9e4e9163c670ff48663244b4057eafMaurice Lam
213180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    /**
214180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     * Gets the divider height, in pixels.
215180360409c9e4e9163c670ff48663244b4057eafMaurice Lam     */
216180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    public int getDividerHeight() {
217180360409c9e4e9163c670ff48663244b4057eafMaurice Lam        return mDividerHeight;
218180360409c9e4e9163c670ff48663244b4057eafMaurice Lam    }
219efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini
220efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    /**
221efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     * Sets whether the divider needs permission from both the item view holder below
222efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     * and above from where the divider would draw itself or just needs permission from
223efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     * one or the other before drawing itself.
224efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     */
225efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    public void setDividerCondition(@DividerCondition int dividerCondition) {
226efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        mDividerCondition = dividerCondition;
227efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    }
228efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini
229efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    /**
230efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     * Gets whether the divider needs permission from both the item view holder below
231efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     * and above from where the divider would draw itself or just needs permission from
232efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     * one or the other before drawing itself.
233efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini     */
234efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    @DividerCondition
235efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    public int getDividerCondition() {
236efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini        return mDividerCondition;
237efd346d200a1649d94c5a1add1636de5b7d56eefUdam Saini    }
238180360409c9e4e9163c670ff48663244b4057eafMaurice Lam}
239