DividerItemDecoration.java
3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package android.support.v7.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat;
import android.view.View;
public class DividerItemDecoration
extends RecyclerView.ItemDecoration
{
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
private static final int[] a = { 16843284 };
private Drawable b;
private int c;
private final Rect d = new Rect();
public DividerItemDecoration(Context paramContext, int paramInt)
{
paramContext = paramContext.obtainStyledAttributes(a);
this.b = paramContext.getDrawable(0);
paramContext.recycle();
setOrientation(paramInt);
}
public void getItemOffsets(Rect paramRect, View paramView, RecyclerView paramRecyclerView, RecyclerView.State paramState)
{
if (this.c == 1)
{
paramRect.set(0, 0, 0, this.b.getIntrinsicHeight());
return;
}
paramRect.set(0, 0, this.b.getIntrinsicWidth(), 0);
}
public void onDraw(Canvas paramCanvas, RecyclerView paramRecyclerView, RecyclerView.State paramState)
{
int m = 0;
int k = 0;
if (paramRecyclerView.getLayoutManager() == null) {
return;
}
int j;
int i;
int n;
int i1;
if (this.c == 1)
{
paramCanvas.save();
if (paramRecyclerView.getClipToPadding())
{
j = paramRecyclerView.getPaddingLeft();
i = paramRecyclerView.getWidth() - paramRecyclerView.getPaddingRight();
paramCanvas.clipRect(j, paramRecyclerView.getPaddingTop(), i, paramRecyclerView.getHeight() - paramRecyclerView.getPaddingBottom());
}
for (;;)
{
m = paramRecyclerView.getChildCount();
while (k < m)
{
paramState = paramRecyclerView.getChildAt(k);
paramRecyclerView.getDecoratedBoundsWithMargins(paramState, this.d);
n = this.d.bottom;
n = Math.round(ViewCompat.getTranslationY(paramState)) + n;
i1 = this.b.getIntrinsicHeight();
this.b.setBounds(j, n - i1, i, n);
this.b.draw(paramCanvas);
k += 1;
}
i = paramRecyclerView.getWidth();
j = 0;
}
paramCanvas.restore();
return;
}
paramCanvas.save();
if (paramRecyclerView.getClipToPadding())
{
j = paramRecyclerView.getPaddingTop();
i = paramRecyclerView.getHeight() - paramRecyclerView.getPaddingBottom();
paramCanvas.clipRect(paramRecyclerView.getPaddingLeft(), j, paramRecyclerView.getWidth() - paramRecyclerView.getPaddingRight(), i);
}
for (;;)
{
n = paramRecyclerView.getChildCount();
k = m;
while (k < n)
{
paramState = paramRecyclerView.getChildAt(k);
paramRecyclerView.getLayoutManager().getDecoratedBoundsWithMargins(paramState, this.d);
m = this.d.right;
m = Math.round(ViewCompat.getTranslationX(paramState)) + m;
i1 = this.b.getIntrinsicWidth();
this.b.setBounds(m - i1, j, m, i);
this.b.draw(paramCanvas);
k += 1;
}
i = paramRecyclerView.getHeight();
j = 0;
}
paramCanvas.restore();
}
public void setDrawable(@NonNull Drawable paramDrawable)
{
if (paramDrawable == null) {
throw new IllegalArgumentException("Drawable cannot be null.");
}
this.b = paramDrawable;
}
public void setOrientation(int paramInt)
{
if ((paramInt != 0) && (paramInt != 1)) {
throw new IllegalArgumentException("Invalid orientation. It should be either HORIZONTAL or VERTICAL");
}
this.c = paramInt;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v7/widget/DividerItemDecoration.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/