Skip to content

Commit 53f6b0f

Browse files
committed
Minor renamings and JavaDoc fixes; Moved entities out of their package
1 parent cb0a98b commit 53f6b0f

8 files changed

Lines changed: 115 additions & 105 deletions

File tree

library/src/main/java/com/proxerme/library/connection/messenger/entity/Conference.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.proxerme.library.interfaces.TimeItem;
1313

1414
/**
15-
* Class representing a single conference. This might be a group chat or a conversation with a
15+
* Class representing a single conferenceInfo. This might be a group chat or a conversation with a
1616
* single user (indicated by {@link #isGroup()}.
1717
*
1818
* @author Ruben Gees
@@ -59,15 +59,15 @@ public Conference[] newArray(int size) {
5959
/**
6060
* The constructor.
6161
*
62-
* @param id The id of this conference.
62+
* @param id The id of this conferenceInfo.
6363
* @param topic The topic.
6464
* @param customTopic A custom topic set by a user.
65-
* @param participantAmount The amount of participants in this conference.
65+
* @param participantAmount The amount of participants in this conferenceInfo.
6666
* @param imageType The type of the image. This is "avatar" in most cases.
6767
* @param imageId The id of the image.
6868
* @param isGroup Indicator if this is a group chat.
69-
* @param isRead Indicator if this conference has been read by the current user.
70-
* @param time The time of the last message in this conference.
69+
* @param isRead Indicator if this conferenceInfo has been read by the current user.
70+
* @param time The time of the last message in this conferenceInfo.
7171
* @param unreadMessageAmount The amount of unread messages for the current user.
7272
* @param lastReadMessageId The id of the last read message of the current user.
7373
*/
@@ -159,7 +159,7 @@ public boolean isRead() {
159159
}
160160

161161
/**
162-
* Returns the custom topic for this conference. Might be empty.
162+
* Returns the custom topic for this conferenceInfo. Might be empty.
163163
*
164164
* @return The custom topic.
165165
*/
@@ -169,7 +169,7 @@ public String getCustomTopic() {
169169
}
170170

171171
/**
172-
* Returns the amount of participants in this conference.
172+
* Returns the amount of participants in this conferenceInfo.
173173
*
174174
* @return The amount.
175175
*/
@@ -179,7 +179,7 @@ public int getParticipantAmount() {
179179
}
180180

181181
/**
182-
* Returns the topic of this conference.
182+
* Returns the topic of this conferenceInfo.
183183
*
184184
* @return The topic.
185185
*/
@@ -189,7 +189,7 @@ public String getTopic() {
189189
}
190190

191191
/**
192-
* Returns the id of this conference.
192+
* Returns the id of this conferenceInfo.
193193
*
194194
* @return The id.
195195
*/
@@ -200,7 +200,7 @@ public String getId() {
200200
}
201201

202202
/**
203-
* Returns the time of the last message in this conference.
203+
* Returns the time of the last message in this conferenceInfo.
204204
*
205205
* @return The time.
206206
*/
@@ -210,7 +210,7 @@ public long getTime() {
210210
}
211211

212212
/**
213-
* Returns if this conference is a group chat.
213+
* Returns if this conferenceInfo is a group chat.
214214
*
215215
* @return True, if it is a group chat.
216216
*/

library/src/main/java/com/proxerme/library/connection/messenger/entity/conferenceInfo/ConferenceInfo.java renamed to library/src/main/java/com/proxerme/library/connection/messenger/entity/ConferenceInfo.java

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.proxerme.library.connection.messenger.entity.conferenceInfo;
1+
package com.proxerme.library.connection.messenger.entity;
22

33
import android.os.Parcel;
44
import android.os.Parcelable;
@@ -32,9 +32,9 @@ public ConferenceInfo[] newArray(int size) {
3232
@Body(name = "count")
3333
int participants;
3434
@Body(name = "timestampStart")
35-
long timestampStart;
35+
long firstMessageTime;
3636
@Body(name = "timestampEnd")
37-
long timestampEnd;
37+
long lastMessageTime;
3838
@Body(name = "leader")
3939
String leaderId;
4040

@@ -47,19 +47,19 @@ public ConferenceInfo[] newArray(int size) {
4747
/**
4848
* The Constructor.
4949
*
50-
* @param topic The topic.
51-
* @param participants The participants of this conference.
52-
* @param timestampStart The timestamp when the conference started.
53-
* @param timestampEnd The timestamp when the last message of the conference was sent.
54-
* @param leaderId The user id of the conference leader.
50+
* @param topic The topic.
51+
* @param participants The amount of participants in this conferenceInfo.
52+
* @param firstMessageTime The time when the conferenceInfo started.
53+
* @param lastMessageTime The time when the last message of the conferenceInfo was sent.
54+
* @param leaderId The user id of the conferenceInfo leader.
5555
*/
5656
public ConferenceInfo(@NonNull String topic, @IntRange(from = 2) int participants,
57-
@IntRange(from = 0) long timestampStart, @IntRange(from = 0) long timestampEnd,
58-
@NonNull String leaderId) {
57+
@IntRange(from = 0) long firstMessageTime,
58+
@IntRange(from = 0) long lastMessageTime, @NonNull String leaderId) {
5959
this.topic = topic;
6060
this.participants = participants;
61-
this.timestampStart = timestampStart;
62-
this.timestampEnd = timestampEnd;
61+
this.firstMessageTime = firstMessageTime;
62+
this.lastMessageTime = lastMessageTime;
6363
this.leaderId = leaderId;
6464
}
6565

@@ -71,27 +71,11 @@ public ConferenceInfo(@NonNull String topic, @IntRange(from = 2) int participant
7171
protected ConferenceInfo(Parcel in) {
7272
topic = in.readString();
7373
participants = in.readInt();
74-
timestampStart = in.readLong();
75-
timestampEnd = in.readLong();
74+
firstMessageTime = in.readLong();
75+
lastMessageTime = in.readLong();
7676
leaderId = in.readString();
7777
}
7878

79-
80-
@Override
81-
public int describeContents() {
82-
return 0;
83-
}
84-
85-
@Override
86-
public void writeToParcel(Parcel parcel, int i) {
87-
parcel.writeString(topic);
88-
parcel.writeInt(participants);
89-
parcel.writeLong(timestampStart);
90-
parcel.writeLong(timestampEnd);
91-
parcel.writeString(leaderId);
92-
}
93-
94-
9579
/**
9680
* Returns the Topic.
9781
*
@@ -113,29 +97,29 @@ public int getParticipants() {
11397
}
11498

11599
/**
116-
* Returns the TimestampStart.
100+
* Returns the time of the first message.
117101
*
118-
* @return The TimestampStart.
102+
* @return The time.
119103
**/
120104
@IntRange(from = 0)
121-
public long getTimestampStart() {
122-
return timestampStart;
105+
public long getFirstMessageTime() {
106+
return firstMessageTime;
123107
}
124108

125109
/**
126-
* Returns the TimestampEnd.
110+
* Returns the time of the last message.
127111
*
128-
* @return The TimestampEnd.
112+
* @return The time.
129113
**/
130114
@IntRange(from = 0)
131-
public long getTimestampEnd() {
132-
return timestampEnd;
115+
public long getLastMessageTime() {
116+
return lastMessageTime;
133117
}
134118

135119
/**
136-
* Returns the Leader.
120+
* Returns the id of the conferenceInfo leader.
137121
*
138-
* @return The Leader.
122+
* @return The id.
139123
**/
140124
@NonNull
141125
public String getLeaderId() {
@@ -151,8 +135,8 @@ public boolean equals(Object o) {
151135
ConferenceInfo that = (ConferenceInfo) o;
152136

153137
if (participants != that.participants) return false;
154-
if (timestampStart != that.timestampStart) return false;
155-
if (timestampEnd != that.timestampEnd) return false;
138+
if (firstMessageTime != that.firstMessageTime) return false;
139+
if (lastMessageTime != that.lastMessageTime) return false;
156140
if (!topic.equals(that.topic)) return false;
157141
return leaderId.equals(that.leaderId);
158142

@@ -162,9 +146,23 @@ public boolean equals(Object o) {
162146
public int hashCode() {
163147
int result = topic.hashCode();
164148
result = 31 * result + participants;
165-
result = 31 * result + (int) (timestampStart ^ (timestampStart >>> 32));
166-
result = 31 * result + (int) (timestampEnd ^ (timestampEnd >>> 32));
149+
result = 31 * result + (int) (firstMessageTime ^ (firstMessageTime >>> 32));
150+
result = 31 * result + (int) (lastMessageTime ^ (lastMessageTime >>> 32));
167151
result = 31 * result + leaderId.hashCode();
168152
return result;
169153
}
154+
155+
@Override
156+
public int describeContents() {
157+
return 0;
158+
}
159+
160+
@Override
161+
public void writeToParcel(Parcel parcel, int i) {
162+
parcel.writeString(topic);
163+
parcel.writeInt(participants);
164+
parcel.writeLong(firstMessageTime);
165+
parcel.writeLong(lastMessageTime);
166+
parcel.writeString(leaderId);
167+
}
170168
}

library/src/main/java/com/proxerme/library/connection/messenger/entity/ConferenceInfoContainer.java

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
import android.support.annotation.NonNull;
66

77
import com.afollestad.bridge.annotations.Body;
8-
import com.proxerme.library.connection.messenger.entity.conferenceInfo.ConferenceInfoUser;
98

109
import java.util.Arrays;
1110

1211
/**
13-
* Class that represents the infos of a conference such as the participating users.
12+
* Class that represents the info of a conference such as the participating users.
1413
*
1514
* @author Desnoo
1615
*/
@@ -28,10 +27,10 @@ public ConferenceInfoContainer[] newArray(int size) {
2827
}
2928
};
3029

31-
@Body(name = "conference")
32-
Conference conference;
30+
@Body(name = "conferenceInfo")
31+
ConferenceInfo conferenceInfo;
3332
@Body(name = "users")
34-
ConferenceInfoUser[] conferenceInfoUser;
33+
ConferenceInfoUser[] participants;
3534

3635
/**
3736
* Private Constructor.
@@ -42,12 +41,13 @@ public ConferenceInfoContainer[] newArray(int size) {
4241
/**
4342
* The Constructor.
4443
*
45-
* @param conference The conference object.
46-
* @param conferenceInfoUser The user object.
44+
* @param conferenceInfo The conferenceInfo object.
45+
* @param participants The participants of the conference.
4746
*/
48-
public ConferenceInfoContainer(@NonNull Conference conference, @NonNull ConferenceInfoUser[] conferenceInfoUser) {
49-
this.conference = conference;
50-
this.conferenceInfoUser = conferenceInfoUser;
47+
public ConferenceInfoContainer(@NonNull ConferenceInfo conferenceInfo,
48+
@NonNull ConferenceInfoUser[] participants) {
49+
this.conferenceInfo = conferenceInfo;
50+
this.participants = participants;
5151
}
5252

5353
/**
@@ -56,8 +56,8 @@ public ConferenceInfoContainer(@NonNull Conference conference, @NonNull Conferen
5656
* @param in The parcel to parse.
5757
*/
5858
protected ConferenceInfoContainer(Parcel in) {
59-
conference = in.readParcelable(Conference.class.getClassLoader());
60-
conferenceInfoUser = in.createTypedArray(ConferenceInfoUser.CREATOR);
59+
conferenceInfo = in.readParcelable(Conference.class.getClassLoader());
60+
participants = in.createTypedArray(ConferenceInfoUser.CREATOR);
6161
}
6262

6363
@Override
@@ -67,28 +67,28 @@ public int describeContents() {
6767

6868
@Override
6969
public void writeToParcel(Parcel parcel, int i) {
70-
parcel.writeParcelable(conference, i);
71-
parcel.writeTypedArray(conferenceInfoUser, i);
70+
parcel.writeParcelable(conferenceInfo, i);
71+
parcel.writeTypedArray(participants, i);
7272
}
7373

7474
/**
7575
* Returns the ConferenceInfo.
7676
*
77-
* @return The ConferenceInfo.
77+
* @return The ConferenceInfo.
7878
**/
7979
@NonNull
80-
public Conference getConference() {
81-
return conference;
80+
public ConferenceInfo getConferenceInfo() {
81+
return conferenceInfo;
8282
}
8383

8484
/**
85-
* Returns the User.
85+
* Returns the participants.
8686
*
87-
* @return The User.
87+
* @return The participants.
8888
**/
8989
@NonNull
90-
public ConferenceInfoUser[] getConferenceInfoUser() {
91-
return conferenceInfoUser;
90+
public ConferenceInfoUser[] getParticipants() {
91+
return participants;
9292
}
9393

9494
@Override
@@ -98,16 +98,15 @@ public boolean equals(Object o) {
9898

9999
ConferenceInfoContainer that = (ConferenceInfoContainer) o;
100100

101-
if (!conference.equals(that.conference)) return false;
102-
// Probably incorrect - comparing Object[] arrays with Arrays.equals
103-
return Arrays.equals(conferenceInfoUser, that.conferenceInfoUser);
101+
if (!conferenceInfo.equals(that.conferenceInfo)) return false;
102+
return Arrays.equals(participants, that.participants);
104103

105104
}
106105

107106
@Override
108107
public int hashCode() {
109-
int result = conference.hashCode();
110-
result = 31 * result + Arrays.hashCode(conferenceInfoUser);
108+
int result = conferenceInfo.hashCode();
109+
result = 31 * result + Arrays.hashCode(participants);
111110
return result;
112111
}
113112
}

0 commit comments

Comments
 (0)