Fix subscription picker items flickering in the feed group dialog

The adapter could not tell the items were the same because the
subscription class was missing some methods (i.e. equals and hashcode),
so a full rebind was being done.
This commit is contained in:
Mauricio Colli 2020-04-05 16:27:53 -03:00
parent c24dfc63dc
commit 9f3b35634a
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
1 changed files with 51 additions and 0 deletions

View File

@ -130,4 +130,55 @@ public class SubscriptionEntity {
item.setDescription(getDescription()); item.setDescription(getDescription());
return item; return item;
} }
// TODO: Remove these generated methods by migrating this class to a data class from Kotlin.
@Override
@SuppressWarnings("EqualsReplaceableByObjectsCall")
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final SubscriptionEntity that = (SubscriptionEntity) o;
if (uid != that.uid) {
return false;
}
if (serviceId != that.serviceId) {
return false;
}
if (!url.equals(that.url)) {
return false;
}
if (name != null ? !name.equals(that.name) : that.name != null) {
return false;
}
if (avatarUrl != null ? !avatarUrl.equals(that.avatarUrl) : that.avatarUrl != null) {
return false;
}
if (subscriberCount != null
? !subscriberCount.equals(that.subscriberCount)
: that.subscriberCount != null) {
return false;
}
return description != null
? description.equals(that.description)
: that.description == null;
}
@Override
public int hashCode() {
int result = (int) (uid ^ (uid >>> 32));
result = 31 * result + serviceId;
result = 31 * result + url.hashCode();
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (avatarUrl != null ? avatarUrl.hashCode() : 0);
result = 31 * result + (subscriberCount != null ? subscriberCount.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
return result;
}
} }