blob: f713d5acbf69ec35e916cfe6f71625119302b7d5 (
plain) (
blame)
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
|
package ml.docilealligator.infinityforreddit.subreddit;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.Gson;
import com.google.gson.JsonParseException;
public class Flair implements Parcelable {
public static final Creator<Flair> CREATOR = new Creator<Flair>() {
@Override
public Flair createFromParcel(Parcel in) {
return new Flair(in);
}
@Override
public Flair[] newArray(int size) {
return new Flair[size];
}
};
private String id;
private String text;
private boolean editable;
Flair(String id, String text, boolean editable) {
this.id = id;
this.text = text;
this.editable = editable;
}
protected Flair(Parcel in) {
id = in.readString();
text = in.readString();
editable = in.readByte() != 0;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public boolean isEditable() {
return editable;
}
public void setEditable(boolean editable) {
this.editable = editable;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(id);
parcel.writeString(text);
parcel.writeByte((byte) (editable ? 1 : 0));
}
public String getJSONModel() {
return new Gson().toJson(this);
}
public static Flair fromJson(String json) throws JsonParseException {
return new Gson().fromJson(json, Flair.class);
}
}
|