mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
Less deprecated usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
875c66ea8a
commit
21093282f9
@ -106,11 +106,11 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
||||
holder.avatarImageView.setController(null);
|
||||
|
||||
if (adapter.hasFilter()) {
|
||||
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getName(),
|
||||
FlexibleUtils.highlightText(holder.contactDisplayName, participant.getDisplayName(),
|
||||
String.valueOf(adapter.getFilter(String.class)), NextcloudTalkApplication.Companion.getSharedApplication()
|
||||
.getResources().getColor(R.color.colorPrimary));
|
||||
} else {
|
||||
holder.contactDisplayName.setText(participant.getName());
|
||||
holder.contactDisplayName.setText(participant.getDisplayName());
|
||||
}
|
||||
|
||||
holder.serverUrl.setText(userEntity.getBaseUrl());
|
||||
@ -122,7 +122,7 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
||||
.setOldController(holder.avatarImageView.getController())
|
||||
.setAutoPlayAnimations(true)
|
||||
.setImageRequest(DisplayUtils.getImageRequestForUrl(ApiUtils.getUrlForAvatarWithName(userEntity.getBaseUrl(),
|
||||
participant.getUserId(), R.dimen.avatar_size), null))
|
||||
participant.getActorId(), R.dimen.avatar_size), null))
|
||||
.build();
|
||||
holder.avatarImageView.setController(draweeController);
|
||||
|
||||
@ -138,8 +138,8 @@ public class AdvancedUserItem extends AbstractFlexibleItem<AdvancedUserItem.User
|
||||
|
||||
@Override
|
||||
public boolean filter(String constraint) {
|
||||
return participant.getName() != null &&
|
||||
Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL).matcher(participant.getName().trim()).find();
|
||||
return participant.getDisplayName() != null &&
|
||||
Pattern.compile(constraint, Pattern.CASE_INSENSITIVE | Pattern.LITERAL).matcher(participant.getDisplayName().trim()).find();
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,6 +61,8 @@ import com.nextcloud.talk.models.json.autocomplete.AutocompleteOverall;
|
||||
import com.nextcloud.talk.models.json.autocomplete.AutocompleteUser;
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation;
|
||||
import com.nextcloud.talk.models.json.conversations.RoomOverall;
|
||||
import com.nextcloud.talk.models.json.converters.EnumActorTypeConverter;
|
||||
import com.nextcloud.talk.models.json.converters.EnumParticipantTypeConverter;
|
||||
import com.nextcloud.talk.models.json.participants.Participant;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.ConductorRemapping;
|
||||
@ -508,6 +510,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
Participant participant;
|
||||
|
||||
List<AbstractFlexibleItem> newUserItemList = new ArrayList<>();
|
||||
EnumActorTypeConverter actorTypeConverter = new EnumActorTypeConverter();
|
||||
|
||||
try {
|
||||
AutocompleteOverall autocompleteOverall = LoganSquare.parse(responseBody.string(), AutocompleteOverall.class);
|
||||
@ -516,13 +519,14 @@ public class ContactsController extends BaseController implements SearchView.OnQ
|
||||
for (AutocompleteUser autocompleteUser : autocompleteUsersHashSet) {
|
||||
if (!autocompleteUser.getId().equals(currentUser.getUserId()) && !existingParticipants.contains(autocompleteUser.getId())) {
|
||||
participant = new Participant();
|
||||
participant.setUserId(autocompleteUser.getId());
|
||||
participant.setActorId(autocompleteUser.getId());
|
||||
participant.setActorType(actorTypeConverter.getFromString(autocompleteUser.getSource()));
|
||||
participant.setDisplayName(autocompleteUser.getLabel());
|
||||
participant.setSource(autocompleteUser.getSource());
|
||||
|
||||
String headerTitle;
|
||||
|
||||
if (!autocompleteUser.getSource().equals("groups")) {
|
||||
if (participant.getActorType() != Participant.ActorType.GROUPS) {
|
||||
headerTitle = participant.getDisplayName().substring(0, 1).toUpperCase();
|
||||
} else {
|
||||
headerTitle = getResources().getString(R.string.nc_groups);
|
||||
|
@ -419,12 +419,8 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
} else {
|
||||
userItem.isOnline = !participant.sessionIds!!.isEmpty()
|
||||
}
|
||||
if (!TextUtils.isEmpty(participant.userId) && participant.userId == conversationUser!!.userId) {
|
||||
ownUserItem = userItem
|
||||
ownUserItem.model.sessionId = "-1"
|
||||
ownUserItem.isOnline = true
|
||||
} else if (participant.actorType != null && participant.actorType == USERS
|
||||
&& !TextUtils.isEmpty(participant.actorId) && participant.actorId == conversationUser!!.userId) {
|
||||
|
||||
if (participant.getActorType() == USERS && participant.getActorId() == conversationUser!!.userId) {
|
||||
ownUserItem = userItem
|
||||
ownUserItem.model.sessionId = "-1"
|
||||
ownUserItem.isOnline = true
|
||||
@ -491,7 +487,9 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
|
||||
recyclerViewItems.forEach {
|
||||
val userItem = it as UserItem
|
||||
existingParticipantsId.add(userItem.model.userId)
|
||||
if (userItem.model.getActorType() == USERS) {
|
||||
existingParticipantsId.add(userItem.model.getActorId())
|
||||
}
|
||||
}
|
||||
|
||||
bundle.putBoolean(BundleKeys.KEY_ADD_PARTICIPANTS, true)
|
||||
@ -920,7 +918,7 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
|
||||
val apiVersion = ApiUtils.getConversationApiVersion(conversationUser, intArrayOf(ApiUtils.APIv4, 1))
|
||||
|
||||
if (participant.getUserId() == conversationUser!!.userId) {
|
||||
if (participant.getActorType() == USERS && participant.getActorId() == conversationUser!!.userId) {
|
||||
if (participant.attendeePin.isNotEmpty()) {
|
||||
val items = mutableListOf(
|
||||
BasicListItemWithImage(
|
||||
@ -980,11 +978,13 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
)
|
||||
)
|
||||
|
||||
if (participant.type == Participant.ParticipantType.MODERATOR
|
||||
|| participant.type == Participant.ParticipantType.GUEST_MODERATOR) {
|
||||
if (participant.type == Participant.ParticipantType.MODERATOR ||
|
||||
participant.type == Participant.ParticipantType.GUEST_MODERATOR
|
||||
) {
|
||||
items.removeAt(1)
|
||||
} else if (participant.type == Participant.ParticipantType.USER
|
||||
|| participant.type == Participant.ParticipantType.GUEST) {
|
||||
} else if (participant.type == Participant.ParticipantType.USER ||
|
||||
participant.type == Participant.ParticipantType.GUEST
|
||||
) {
|
||||
items.removeAt(2)
|
||||
} else {
|
||||
// Self joined users can not be promoted nor demoted
|
||||
@ -1054,7 +1054,6 @@ class ConversationInfoController(args: Bundle) : BaseController(args), FlexibleA
|
||||
moderatorTypes.add(Participant.ParticipantType.OWNER)
|
||||
moderatorTypes.add(Participant.ParticipantType.GUEST_MODERATOR)
|
||||
|
||||
|
||||
if (moderatorTypes.contains(left.model.type) && !moderatorTypes.contains(right.model.type)) {
|
||||
return -1
|
||||
} else if (!moderatorTypes.contains(left.model.type) && moderatorTypes.contains(right.model.type)) {
|
||||
|
@ -178,17 +178,17 @@ public class SwitchAccountController extends BaseController {
|
||||
for (Object userEntityObject : userUtils.getUsers()) {
|
||||
userEntity = (UserEntity) userEntityObject;
|
||||
if (!userEntity.getCurrent()) {
|
||||
participant = new Participant();
|
||||
participant.setName(userEntity.getDisplayName());
|
||||
|
||||
String userId;
|
||||
|
||||
if (userEntity.getUserId() != null) {
|
||||
userId = userEntity.getUserId();
|
||||
} else {
|
||||
userId = userEntity.getUsername();
|
||||
}
|
||||
participant.setUserId(userId);
|
||||
|
||||
participant = new Participant();
|
||||
participant.setActorType(Participant.ActorType.USERS);
|
||||
participant.setActorId(userId);
|
||||
participant.setDisplayName(userEntity.getDisplayName());
|
||||
userItems.add(new AdvancedUserItem(participant, userEntity, null));
|
||||
}
|
||||
}
|
||||
@ -203,8 +203,9 @@ public class SwitchAccountController extends BaseController {
|
||||
importAccount = AccountUtils.INSTANCE.getInformationFromAccount(account);
|
||||
|
||||
participant = new Participant();
|
||||
participant.setName(importAccount.getUsername());
|
||||
participant.setUserId(importAccount.getUsername());
|
||||
participant.setActorType(Participant.ActorType.USERS);
|
||||
participant.setActorId(importAccount.getUsername());
|
||||
participant.setDisplayName(importAccount.getUsername());
|
||||
userEntity = new UserEntity();
|
||||
userEntity.setBaseUrl(importAccount.getBaseUrl());
|
||||
userItems.add(new AdvancedUserItem(participant, userEntity, account));
|
||||
|
@ -105,14 +105,18 @@ public class Participant {
|
||||
}
|
||||
|
||||
public ActorType getActorType() {
|
||||
if (this.userId != null) {
|
||||
return ActorType.USERS;
|
||||
if (this.actorType == null) {
|
||||
if (this.userId != null) {
|
||||
return ActorType.USERS;
|
||||
} else {
|
||||
return ActorType.GUESTS;
|
||||
}
|
||||
}
|
||||
return actorType;
|
||||
}
|
||||
|
||||
public String getActorId() {
|
||||
if (this.userId != null) {
|
||||
if (this.actorId == null) {
|
||||
return this.userId;
|
||||
}
|
||||
return actorId;
|
||||
|
Loading…
Reference in New Issue
Block a user