44import android .os .Parcelable ;
55import android .support .annotation .IntRange ;
66import android .support .annotation .NonNull ;
7+ import android .support .annotation .Nullable ;
78
89import com .afollestad .bridge .annotations .Body ;
910import com .proxerme .library .interfaces .IdItem ;
@@ -39,7 +40,7 @@ public Conference[] newArray(int size) {
3940 @ Body (name = "count" )
4041 private int participantAmount ;
4142 @ Body (name = "image" )
42- private String imageId ;
43+ private String image ;
4344 @ Body (name = "group" )
4445 private boolean isGroup ;
4546 @ Body (name = "read" )
@@ -55,25 +56,30 @@ public Conference[] newArray(int size) {
5556 }
5657
5758 public Conference (@ NonNull String id , @ NonNull String topic , @ NonNull String customTopic ,
58- @ IntRange (from = 2 ) int participantAmount , @ NonNull String imageId ,
59- boolean isGroup , boolean isRead , long time ,
59+ @ IntRange (from = 2 ) int participantAmount , @ Nullable String imageType ,
60+ @ Nullable String imageId , boolean isGroup , boolean isRead , long time ,
6061 @ IntRange (from = 0 ) int unreadMessageAmount ,
6162 @ NonNull String lastReadMessageId ) {
6263 this .id = id ;
6364 this .topic = topic ;
6465 this .customTopic = customTopic ;
6566 this .participantAmount = participantAmount ;
66- this .imageId = imageId ;
6767 this .isGroup = isGroup ;
6868 this .isRead = isRead ;
6969 this .time = time ;
7070 this .unreadMessageAmount = unreadMessageAmount ;
7171 this .lastReadMessageId = lastReadMessageId ;
72+
73+ if (imageType == null || imageType .isEmpty () || imageId == null || imageType .isEmpty ()) {
74+ this .image = "" ;
75+ } else {
76+ this .image = imageType + ":" + imageId ;
77+ }
7278 }
7379
7480 protected Conference (Parcel in ) {
7581 this .lastReadMessageId = in .readString ();
76- this .imageId = in .readString ();
82+ this .image = in .readString ();
7783 this .isRead = in .readByte () != 0 ;
7884 this .customTopic = in .readString ();
7985 this .participantAmount = in .readInt ();
@@ -91,7 +97,7 @@ public String getLastReadMessageId() {
9197
9298 @ NonNull
9399 public String getImageType () {
94- String [] split = imageId .split (":" );
100+ String [] split = image .split (":" );
95101
96102 if (split .length == 2 ) {
97103 return split [0 ];
@@ -103,7 +109,7 @@ public String getImageType() {
103109 @ Override
104110 @ NonNull
105111 public String getImageId () {
106- String [] split = imageId .split (":" );
112+ String [] split = image .split (":" );
107113
108114 if (split .length == 2 ) {
109115 return split [1 ];
@@ -164,7 +170,7 @@ public boolean equals(Object o) {
164170 if (isGroup != that .isGroup ) return false ;
165171 if (unreadMessageAmount != that .unreadMessageAmount ) return false ;
166172 if (!lastReadMessageId .equals (that .lastReadMessageId )) return false ;
167- if (!imageId .equals (that .imageId )) return false ;
173+ if (!image .equals (that .image )) return false ;
168174 if (!customTopic .equals (that .customTopic )) return false ;
169175 if (!topic .equals (that .topic )) return false ;
170176 return id .equals (that .id );
@@ -174,7 +180,7 @@ public boolean equals(Object o) {
174180 @ Override
175181 public int hashCode () {
176182 int result = lastReadMessageId .hashCode ();
177- result = 31 * result + imageId .hashCode ();
183+ result = 31 * result + image .hashCode ();
178184 result = 31 * result + (isRead ? 1 : 0 );
179185 result = 31 * result + customTopic .hashCode ();
180186 result = 31 * result + participantAmount ;
@@ -194,7 +200,7 @@ public int describeContents() {
194200 @ Override
195201 public void writeToParcel (Parcel dest , int flags ) {
196202 dest .writeString (this .lastReadMessageId );
197- dest .writeString (this .imageId );
203+ dest .writeString (this .image );
198204 dest .writeByte (this .isRead ? (byte ) 1 : (byte ) 0 );
199205 dest .writeString (this .customTopic );
200206 dest .writeInt (this .participantAmount );
0 commit comments