1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Added AccountHolder

This commit is contained in:
cketti 2012-03-24 20:43:17 +01:00
parent ea90e24785
commit b9e0ec1ab4

View File

@ -3252,18 +3252,20 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
View view = null; View view = null;
if (item instanceof Account) { if (item instanceof Account) {
if (convertView != null && convertView.getTag() instanceof TextView) { if (convertView != null && convertView.getTag() instanceof AccountHolder) {
view = convertView; view = convertView;
} else { } else {
view = mLayoutInflater.inflate(R.layout.choose_account_item, parent, false); view = mLayoutInflater.inflate(R.layout.choose_account_item, parent, false);
TextView name = (TextView) view.findViewById(R.id.name); AccountHolder holder = new AccountHolder();
view.setTag(name); holder.name = (TextView) view.findViewById(R.id.name);
holder.chip = view.findViewById(R.id.chip);
view.setTag(holder);
} }
Account account = (Account) item; Account account = (Account) item;
TextView name = (TextView) view.getTag(); AccountHolder holder = (AccountHolder) view.getTag();
name.setText(account.getDescription()); holder.name.setText(account.getDescription());
view.findViewById(R.id.chip).setBackgroundColor(account.getChipColor()); holder.chip.setBackgroundColor(account.getChipColor());
} else if (item instanceof IdentityContainer) { } else if (item instanceof IdentityContainer) {
if (convertView != null && convertView.getTag() instanceof IdentityHolder) { if (convertView != null && convertView.getTag() instanceof IdentityHolder) {
view = convertView; view = convertView;
@ -3277,7 +3279,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
IdentityContainer identityContainer = (IdentityContainer) item; IdentityContainer identityContainer = (IdentityContainer) item;
Identity identity = identityContainer.identity; Identity identity = identityContainer.identity;
Account account = identityContainer.account;
IdentityHolder holder = (IdentityHolder) view.getTag(); IdentityHolder holder = (IdentityHolder) view.getTag();
holder.name.setText(identity.getDescription()); holder.name.setText(identity.getDescription());
holder.description.setText(getIdentityDescription(identity)); holder.description.setText(getIdentityDescription(identity));
@ -3286,6 +3287,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
return view; return view;
} }
static class AccountHolder {
public TextView name;
public View chip;
}
static class IdentityHolder { static class IdentityHolder {
public TextView name; public TextView name;
public TextView description; public TextView description;