|
5 | 5 |
|
6 | 6 | public class Step implements Parcelable { |
7 | 7 |
|
8 | | - public static final Parcelable.Creator<Step> CREATOR = new Parcelable.Creator<Step>() { |
9 | | - @Override |
10 | | - public Step createFromParcel(Parcel source) { |
11 | | - return new Step(source); |
12 | | - } |
13 | | - |
14 | | - @Override |
15 | | - public Step[] newArray(int size) { |
16 | | - return new Step[size]; |
17 | | - } |
18 | | - }; |
19 | 8 | private String title; |
20 | 9 | private String content; |
21 | 10 | private String summary; |
22 | 11 | private int drawable; |
23 | 12 | private int backgroundColor; |
| 13 | + private int viewType; |
24 | 14 |
|
25 | 15 | public Step() { |
26 | 16 | } |
27 | 17 |
|
28 | | - protected Step(Parcel in) { |
29 | | - this.title = in.readString(); |
30 | | - this.content = in.readString(); |
31 | | - this.summary = in.readString(); |
32 | | - this.drawable = in.readInt(); |
33 | | - this.backgroundColor = in.readInt(); |
| 18 | + public int getViewType() { |
| 19 | + return viewType; |
| 20 | + } |
| 21 | + |
| 22 | + public void setViewType(int viewType) { |
| 23 | + this.viewType = viewType; |
34 | 24 | } |
35 | 25 |
|
36 | 26 | public String getTitle() { |
@@ -73,20 +63,6 @@ public void setSummary(String summary) { |
73 | 63 | this.summary = summary; |
74 | 64 | } |
75 | 65 |
|
76 | | - @Override |
77 | | - public int describeContents() { |
78 | | - return 0; |
79 | | - } |
80 | | - |
81 | | - @Override |
82 | | - public void writeToParcel(Parcel dest, int flags) { |
83 | | - dest.writeString(this.title); |
84 | | - dest.writeString(this.content); |
85 | | - dest.writeString(this.summary); |
86 | | - dest.writeInt(this.drawable); |
87 | | - dest.writeInt(this.backgroundColor); |
88 | | - } |
89 | | - |
90 | 66 | public static class Builder { |
91 | 67 |
|
92 | 68 | private Step step; |
@@ -123,5 +99,47 @@ public Builder setBackgroundColor(int backgroundColor) { |
123 | 99 | step.backgroundColor = backgroundColor; |
124 | 100 | return this; |
125 | 101 | } |
| 102 | + |
| 103 | + public Builder setView(int view) { |
| 104 | + step.viewType = view; |
| 105 | + return this; |
| 106 | + } |
126 | 107 | } |
| 108 | + |
| 109 | + |
| 110 | + @Override |
| 111 | + public int describeContents() { |
| 112 | + return 0; |
| 113 | + } |
| 114 | + |
| 115 | + @Override |
| 116 | + public void writeToParcel(Parcel dest, int flags) { |
| 117 | + dest.writeString(this.title); |
| 118 | + dest.writeString(this.content); |
| 119 | + dest.writeString(this.summary); |
| 120 | + dest.writeInt(this.drawable); |
| 121 | + dest.writeInt(this.backgroundColor); |
| 122 | + dest.writeInt(this.viewType); |
| 123 | + } |
| 124 | + |
| 125 | + protected Step(Parcel in) { |
| 126 | + this.title = in.readString(); |
| 127 | + this.content = in.readString(); |
| 128 | + this.summary = in.readString(); |
| 129 | + this.drawable = in.readInt(); |
| 130 | + this.backgroundColor = in.readInt(); |
| 131 | + this.viewType = in.readInt(); |
| 132 | + } |
| 133 | + |
| 134 | + public static final Creator<Step> CREATOR = new Creator<Step>() { |
| 135 | + @Override |
| 136 | + public Step createFromParcel(Parcel source) { |
| 137 | + return new Step(source); |
| 138 | + } |
| 139 | + |
| 140 | + @Override |
| 141 | + public Step[] newArray(int size) { |
| 142 | + return new Step[size]; |
| 143 | + } |
| 144 | + }; |
127 | 145 | } |
0 commit comments