DividerBean.java
6.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
package com.cnlive.goldenline.ui.model;
import android.os.Parcel;
import android.os.Parcelable;
import java.io.Serializable;
/**
* Description:将列表中分割线作为特定布局显示在RecyclerView中
* Created on 2017/3/5
* Author : 萧
*/
public class DividerBean implements Serializable, Cloneable, Parcelable {
//TODO 设置原始数值 还是设置转换dp以后的值????
private float width;
private float height;
private int leftMargin;
private int rightMargin;
private int topMargin;
private int bottomMargin;
private int paddingLeft;
private int paddingRight;
private int paddingTop;
private int paddingBottom;
// 设置Color 还是 这是ColorRes ???
private int bgColor;
private int gravity;
public DividerBean() {
}
public DividerBean(int width, int height, int paddingLeft, int paddingRight, int paddingTop, int paddingBottom, int bgColor) {
this.width = width;
this.height = height;
this.paddingLeft = paddingLeft;
this.paddingRight = paddingRight;
this.paddingTop = paddingTop;
this.paddingBottom = paddingBottom;
this.bgColor = bgColor;
}
public DividerBean(int width, int height, int leftMargin, int rightMargin, int topMargin, int bottomMargin, int paddingLeft, int paddingRight, int paddingTop, int paddingBottom, int bgColor) {
this.width = width;
this.height = height;
this.leftMargin = leftMargin;
this.rightMargin = rightMargin;
this.topMargin = topMargin;
this.bottomMargin = bottomMargin;
this.paddingLeft = paddingLeft;
this.paddingRight = paddingRight;
this.paddingTop = paddingTop;
this.paddingBottom = paddingBottom;
this.bgColor = bgColor;
}
public DividerBean(int width, int height, int leftMargin, int rightMargin, int topMargin, int bottomMargin, int paddingLeft, int paddingRight, int paddingTop, int paddingBottom, int bgColor, int gravity) {
this.width = width;
this.height = height;
this.leftMargin = leftMargin;
this.rightMargin = rightMargin;
this.topMargin = topMargin;
this.bottomMargin = bottomMargin;
this.paddingLeft = paddingLeft;
this.paddingRight = paddingRight;
this.paddingTop = paddingTop;
this.paddingBottom = paddingBottom;
this.bgColor = bgColor;
this.gravity = gravity;
}
public DividerBean buildDivider1() {
// this.bgColor
this.height = 1;
return this;
}
public int getGravity() {
return gravity;
}
public void setGravity(int gravity) {
this.gravity = gravity;
}
public float getWidth() {
return width;
}
public void setWidth(float width) {
this.width = width;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
public int getPaddingLeft() {
return paddingLeft;
}
public void setPaddingLeft(int paddingLeft) {
this.paddingLeft = paddingLeft;
}
public int getPaddingRight() {
return paddingRight;
}
public void setPaddingRight(int paddingRight) {
this.paddingRight = paddingRight;
}
public int getPaddingTop() {
return paddingTop;
}
public void setPaddingTop(int paddingTop) {
this.paddingTop = paddingTop;
}
public int getPaddingBottom() {
return paddingBottom;
}
public void setPaddingBottom(int paddingBottom) {
this.paddingBottom = paddingBottom;
}
public int getBgColor() {
return bgColor;
}
public void setBgColor(int bgColor) {
this.bgColor = bgColor;
}
public int getLeftMargin() {
return leftMargin;
}
public void setLeftMargin(int leftMargin) {
this.leftMargin = leftMargin;
}
public int getRightMargin() {
return rightMargin;
}
public void setRightMargin(int rightMargin) {
this.rightMargin = rightMargin;
}
public int getTopMargin() {
return topMargin;
}
public void setTopMargin(int topMargin) {
this.topMargin = topMargin;
}
public int getBottomMargin() {
return bottomMargin;
}
public void setBottomMargin(int bottomMargin) {
this.bottomMargin = bottomMargin;
}
@Override
public String toString() {
return "DividerBean{" +
"width=" + width +
", height=" + height +
", leftMargin=" + leftMargin +
", rightMargin=" + rightMargin +
", topMargin=" + topMargin +
", bottomMargin=" + bottomMargin +
", paddingLeft=" + paddingLeft +
", paddingRight=" + paddingRight +
", paddingTop=" + paddingTop +
", paddingBottom=" + paddingBottom +
", bgColor=" + bgColor +
'}';
}
@Override
public DividerBean clone() throws CloneNotSupportedException {
return (DividerBean) super.clone();
}
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
protected void finalize() throws Throwable {
super.finalize();
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeFloat(this.width);
dest.writeFloat(this.height);
dest.writeInt(this.leftMargin);
dest.writeInt(this.rightMargin);
dest.writeInt(this.topMargin);
dest.writeInt(this.bottomMargin);
dest.writeInt(this.paddingLeft);
dest.writeInt(this.paddingRight);
dest.writeInt(this.paddingTop);
dest.writeInt(this.paddingBottom);
dest.writeInt(this.bgColor);
dest.writeInt(this.gravity);
}
protected DividerBean(Parcel in) {
this.width = in.readFloat();
this.height = in.readFloat();
this.leftMargin = in.readInt();
this.rightMargin = in.readInt();
this.topMargin = in.readInt();
this.bottomMargin = in.readInt();
this.paddingLeft = in.readInt();
this.paddingRight = in.readInt();
this.paddingTop = in.readInt();
this.paddingBottom = in.readInt();
this.bgColor = in.readInt();
this.gravity = in.readInt();
}
public static final Parcelable.Creator<DividerBean> CREATOR = new Parcelable.Creator<DividerBean>() {
@Override
public DividerBean createFromParcel(Parcel source) {
return new DividerBean(source);
}
@Override
public DividerBean[] newArray(int size) {
return new DividerBean[size];
}
};
}