Use comparison operator rather than equals for enums in adapters

Fixes SPP_EQUALS_ON_ENUM issue from SpotBugs.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-11-14 01:46:06 +01:00 committed by Tim Krüger
parent 969c08ea79
commit fb0fe8587a
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E
3 changed files with 9 additions and 9 deletions

View File

@ -145,8 +145,8 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
}
if (TextUtils.isEmpty(participant.getDisplayName()) &&
(participant.getType().equals(Participant.ParticipantType.GUEST) ||
participant.getType().equals(Participant.ParticipantType.USER_FOLLOWING_LINK))) {
(participant.getType() == Participant.ParticipantType.GUEST ||
participant.getType() == Participant.ParticipantType.USER_FOLLOWING_LINK)) {
holder.binding.nameText.setText(NextcloudTalkApplication
.Companion
.getSharedApplication()
@ -167,8 +167,8 @@ public class ContactItem extends AbstractFlexibleItem<ContactItem.ContactItemVie
} else if (
participant.getCalculatedActorType() == Participant.ActorType.GUESTS ||
Participant.ParticipantType.GUEST.equals(participant.getType()) ||
Participant.ParticipantType.GUEST_MODERATOR.equals(participant.getType())) {
participant.getType() == Participant.ParticipantType.GUEST ||
participant.getType() == Participant.ParticipantType.GUEST_MODERATOR) {
String displayName;

View File

@ -274,7 +274,7 @@ public class ConversationItem extends AbstractFlexibleItem<ConversationItem.Conv
}
}
if (Conversation.ConversationType.ROOM_SYSTEM.equals(conversation.getType())) {
if (conversation.getType() == Conversation.ConversationType.ROOM_SYSTEM) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Drawable[] layers = new Drawable[2];

View File

@ -140,8 +140,8 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
}
if (TextUtils.isEmpty(participant.getDisplayName()) &&
(participant.getType().equals(Participant.ParticipantType.GUEST) ||
participant.getType().equals(Participant.ParticipantType.USER_FOLLOWING_LINK))) {
(participant.getType() == Participant.ParticipantType.GUEST ||
participant.getType() == Participant.ParticipantType.USER_FOLLOWING_LINK)) {
holder.binding.nameText.setText(NextcloudTalkApplication
.Companion
.getSharedApplication()
@ -170,8 +170,8 @@ public class ParticipantItem extends AbstractFlexibleItem<ParticipantItem.Partic
holder.binding.avatarDraweeView.setImageResource(R.drawable.ic_circular_mail);
}
} else if (participant.getCalculatedActorType() == Participant.ActorType.GUESTS ||
Participant.ParticipantType.GUEST.equals(participant.getType()) ||
Participant.ParticipantType.GUEST_MODERATOR.equals(participant.getType())) {
participant.getType() == Participant.ParticipantType.GUEST ||
participant.getType() == Participant.ParticipantType.GUEST_MODERATOR) {
String displayName = NextcloudTalkApplication.Companion.getSharedApplication()
.getResources().getString(R.string.nc_guest);