Commit 81b4d91b authored by Tiago Cunha's avatar Tiago Cunha Committed by GitHub

Merge branch 'develop' into feature/burger-menu-budge

parents 22e35d12 b1118d16
...@@ -158,7 +158,7 @@ public class MessageListAdapter ...@@ -158,7 +158,7 @@ public class MessageListAdapter
PairedMessage oldMessage = oldList.get(oldItemPosition); PairedMessage oldMessage = oldList.get(oldItemPosition);
PairedMessage newMessage = newList.get(newItemPosition); PairedMessage newMessage = newList.get(newItemPosition);
return oldMessage.toString().equals(newMessage.toString()); return oldMessage.equals(newMessage);
} }
} }
} }
...@@ -44,4 +44,30 @@ public class PairedMessage { ...@@ -44,4 +44,30 @@ public class PairedMessage {
", nextSibling=" + nextSibling + ", nextSibling=" + nextSibling +
'}'; '}';
} }
@SuppressWarnings({"PMD.ShortVariable"})
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PairedMessage that = (PairedMessage) o;
if (!target.equals(that.target)) {
return false;
}
return nextSibling != null ? nextSibling.equals(that.nextSibling) : that.nextSibling == null;
}
@Override
public int hashCode() {
int result = target.hashCode();
result = 31 * result + (nextSibling != null ? nextSibling.hashCode() : 0);
return result;
}
} }
...@@ -9,4 +9,30 @@ import io.realm.annotations.PrimaryKey; ...@@ -9,4 +9,30 @@ import io.realm.annotations.PrimaryKey;
public class Email extends RealmObject { public class Email extends RealmObject {
@PrimaryKey private String address; @PrimaryKey private String address;
private boolean verified; private boolean verified;
@SuppressWarnings({"PMD.ShortVariable"})
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Email email = (Email) o;
if (verified != email.verified) {
return false;
}
return address != null ? address.equals(email.address) : email.address == null;
}
@Override
public int hashCode() {
int result = address != null ? address.hashCode() : 0;
result = 31 * result + (verified ? 1 : 0);
return result;
}
} }
...@@ -148,4 +148,62 @@ public class Message extends RealmObject { ...@@ -148,4 +148,62 @@ public class Message extends RealmObject {
", urls='" + urls + '\'' + ", urls='" + urls + '\'' +
'}'; '}';
} }
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Message message = (Message) o;
if (syncstate != message.syncstate) {
return false;
}
if (ts != message.ts) {
return false;
}
if (groupable != message.groupable) {
return false;
}
if (_id != null ? !_id.equals(message._id) : message._id != null) {
return false;
}
if (t != null ? !t.equals(message.t) : message.t != null) {
return false;
}
if (rid != null ? !rid.equals(message.rid) : message.rid != null) {
return false;
}
if (msg != null ? !msg.equals(message.msg) : message.msg != null) {
return false;
}
if (u != null ? !u.equals(message.u) : message.u != null) {
return false;
}
if (attachments != null ? !attachments.equals(message.attachments)
: message.attachments != null) {
return false;
}
return urls != null ? urls.equals(message.urls) : message.urls == null;
}
@Override
public int hashCode() {
int result = _id != null ? _id.hashCode() : 0;
result = 31 * result + (t != null ? t.hashCode() : 0);
result = 31 * result + (rid != null ? rid.hashCode() : 0);
result = 31 * result + syncstate;
result = 31 * result + (int) (ts ^ (ts >>> 32));
result = 31 * result + (msg != null ? msg.hashCode() : 0);
result = 31 * result + (u != null ? u.hashCode() : 0);
result = 31 * result + (groupable ? 1 : 0);
result = 31 * result + (attachments != null ? attachments.hashCode() : 0);
result = 31 * result + (urls != null ? urls.hashCode() : 0);
return result;
}
} }
...@@ -84,4 +84,86 @@ public class Preferences extends RealmObject { ...@@ -84,4 +84,86 @@ public class Preferences extends RealmObject {
public boolean isHideFlexTab() { public boolean isHideFlexTab() {
return hideFlexTab; return hideFlexTab;
} }
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Preferences that = (Preferences) o;
if (newRoomNotification != that.newRoomNotification) {
return false;
}
if (newMessageNotification != that.newMessageNotification) {
return false;
}
if (useEmojis != that.useEmojis) {
return false;
}
if (convertAsciiEmoji != that.convertAsciiEmoji) {
return false;
}
if (saveMobileBandwidth != that.saveMobileBandwidth) {
return false;
}
if (collapseMediaByDefault != that.collapseMediaByDefault) {
return false;
}
if (unreadRoomsMode != that.unreadRoomsMode) {
return false;
}
if (autoImageLoad != that.autoImageLoad) {
return false;
}
if (unreadAlert != that.unreadAlert) {
return false;
}
if (desktopNotificationDuration != that.desktopNotificationDuration) {
return false;
}
if (viewMode != that.viewMode) {
return false;
}
if (hideUsernames != that.hideUsernames) {
return false;
}
if (hideAvatars != that.hideAvatars) {
return false;
}
if (hideFlexTab != that.hideFlexTab) {
return false;
}
if (id != null ? !id.equals(that.id) : that.id != null) {
return false;
}
return emailNotificationMode != null ? emailNotificationMode.equals(that.emailNotificationMode)
: that.emailNotificationMode == null;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (newRoomNotification ? 1 : 0);
result = 31 * result + (newMessageNotification ? 1 : 0);
result = 31 * result + (useEmojis ? 1 : 0);
result = 31 * result + (convertAsciiEmoji ? 1 : 0);
result = 31 * result + (saveMobileBandwidth ? 1 : 0);
result = 31 * result + (collapseMediaByDefault ? 1 : 0);
result = 31 * result + (unreadRoomsMode ? 1 : 0);
result = 31 * result + (autoImageLoad ? 1 : 0);
result = 31 * result + (emailNotificationMode != null ? emailNotificationMode.hashCode() : 0);
result = 31 * result + (unreadAlert ? 1 : 0);
result = 31 * result + desktopNotificationDuration;
result = 31 * result + viewMode;
result = 31 * result + (hideUsernames ? 1 : 0);
result = 31 * result + (hideAvatars ? 1 : 0);
result = 31 * result + (hideFlexTab ? 1 : 0);
return result;
}
} }
...@@ -13,4 +13,30 @@ public class Settings extends RealmObject { ...@@ -13,4 +13,30 @@ public class Settings extends RealmObject {
public Preferences getPreferences() { public Preferences getPreferences() {
return preferences; return preferences;
} }
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Settings settings = (Settings) o;
if (id != null ? !id.equals(settings.id) : settings.id != null) {
return false;
}
return preferences != null ? preferences.equals(settings.preferences)
: settings.preferences == null;
}
@Override
public int hashCode() {
int result = id != null ? id.hashCode() : 0;
result = 31 * result + (preferences != null ? preferences.hashCode() : 0);
return result;
}
} }
...@@ -91,4 +91,48 @@ public class User extends RealmObject { ...@@ -91,4 +91,48 @@ public class User extends RealmObject {
", settings=" + settings + ", settings=" + settings +
'}'; '}';
} }
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User user = (User) o;
if (Double.compare(user.utcOffset, utcOffset) != 0) {
return false;
}
if (_id != null ? !_id.equals(user._id) : user._id != null) {
return false;
}
if (username != null ? !username.equals(user.username) : user.username != null) {
return false;
}
if (status != null ? !status.equals(user.status) : user.status != null) {
return false;
}
if (emails != null ? !emails.equals(user.emails) : user.emails != null) {
return false;
}
return settings != null ? settings.equals(user.settings) : user.settings == null;
}
@Override
public int hashCode() {
int result;
long temp;
result = _id != null ? _id.hashCode() : 0;
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (status != null ? status.hashCode() : 0);
temp = Double.doubleToLongBits(utcOffset);
result = 31 * result + (int) (temp ^ (temp >>> 32));
result = 31 * result + (emails != null ? emails.hashCode() : 0);
result = 31 * result + (settings != null ? settings.hashCode() : 0);
return result;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment