use of com.nextcloud.talk.adapters.items.AdvancedUserItem in project talk-android by nextcloud.
the class SwitchAccountController method onViewBound.
@Override
protected void onViewBound(@NonNull View view) {
super.onViewBound(view);
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
swipeRefreshLayout.setEnabled(false);
if (adapter == null) {
adapter = new FlexibleAdapter<>(userItems, getActivity(), false);
UserEntity userEntity;
Participant participant;
if (!isAccountImport) {
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);
userItems.add(new AdvancedUserItem(participant, userEntity, null));
}
}
adapter.addListener(onSwitchItemClickListener);
adapter.updateDataSet(userItems, false);
} else {
if (getActionBar() != null) {
getActionBar().show();
}
Account account;
ImportAccount importAccount;
for (Object accountObject : AccountUtils.findAccounts(userUtils.getUsers())) {
account = (Account) accountObject;
importAccount = AccountUtils.getInformationFromAccount(account);
participant = new Participant();
participant.setName(importAccount.getUsername());
participant.setUserId(importAccount.getUsername());
userEntity = new UserEntity();
userEntity.setBaseUrl(importAccount.getBaseUrl());
userItems.add(new AdvancedUserItem(participant, userEntity, account));
}
adapter.addListener(onImportItemClickListener);
adapter.updateDataSet(userItems, false);
}
}
prepareViews();
}
Aggregations