use of com.xabber.android.data.account.AccountItem in project xabber-android by redsolution.
the class NavigationDrawerAccountAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
AccountManager accountManager = AccountManager.getInstance();
if (convertView == null) {
view = getActivity().getLayoutInflater().inflate(R.layout.contact_list_drawer_account_item, parent, false);
} else {
view = convertView;
}
AccountJid account = getItem(position);
((ImageView) view.findViewById(R.id.color)).setImageDrawable(new ColorDrawable((ColorManager.getInstance().getAccountPainter().getAccountMainColor(account))));
((ImageView) view.findViewById(R.id.avatar)).setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
TextView accountName = (TextView) view.findViewById(R.id.name);
try {
accountName.setText(RosterManager.getInstance().getBestContact(account, UserJid.from(accountManager.getVerboseName(account))).getName());
} catch (UserJid.UserJidCreateException e) {
LogManager.exception(this, e);
}
accountName.setTextColor(ColorManager.getInstance().getAccountPainter().getAccountTextColor(account));
((TextView) view.findViewById(R.id.account_jid)).setText(accountManager.getVerboseName(account));
AccountItem accountItem = accountManager.getAccount(account);
ConnectionState state;
if (accountItem == null) {
state = ConnectionState.offline;
} else {
state = accountItem.getState();
}
((TextView) view.findViewById(R.id.status)).setText(getActivity().getString(state.getStringId()));
return view;
}
Aggregations