use of com.xabber.android.ui.color.AccountPainter in project xabber-android by redsolution.
the class ChatScrollIndicatorAdapter method update.
public void update(ArrayList<AbstractChat> activeChats) {
final LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
final int size = activeChats.size() + 1;
linearLayout.removeAllViews();
for (int i = 0; i < size; i++) {
View view;
if (i == 0) {
view = inflater.inflate(R.layout.chat_scroll_indicator_item_square, linearLayout, false);
} else {
view = inflater.inflate(R.layout.chat_scroll_indicator_item_circle, linearLayout, false);
}
linearLayout.addView(view);
final AccountViewHolder accountViewHolder = new AccountViewHolder(view);
final AccountPainter accountPainter = ColorManager.getInstance().getAccountPainter();
if (i > 0) {
final String account = activeChats.get(i - 1).getAccount();
((GradientDrawable) accountViewHolder.body.getDrawable()).setColor(accountPainter.getAccountMainColor(account));
((GradientDrawable) accountViewHolder.selection.getDrawable()).setColor(accountPainter.getAccountMainColor(account));
} else {
accountViewHolder.body.setImageDrawable(new ColorDrawable(accountPainter.getDefaultMainColor()));
accountViewHolder.selection.setImageDrawable(new ColorDrawable(accountPainter.getDefaultMainColor()));
}
view.setTag(accountViewHolder);
}
}
use of com.xabber.android.ui.color.AccountPainter in project xabber-android by redsolution.
the class AccountActionButtonsAdapter method onChange.
@Override
public void onChange() {
for (int index = 0; index < accounts.size(); index++) {
View view = linearLayout.getChildAt(index);
final CircleImageView circleImageView = (CircleImageView) view.findViewById(R.id.account_avatar);
final String account = accounts.get(index);
circleImageView.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
FloatingActionButton backgroundActionButton = (FloatingActionButton) view.findViewById(R.id.fab);
final AccountPainter accountPainter = ColorManager.getInstance().getAccountPainter();
backgroundActionButton.setColorNormal(accountPainter.getAccountMainColor(account));
backgroundActionButton.setColorPressed(accountPainter.getAccountDarkColor(account));
backgroundActionButton.setColorRipple(accountPainter.getAccountRippleColor(account));
String selectedAccount = AccountManager.getInstance().getSelectedAccount();
int shadowVisibility;
if (selectedAccount == null) {
shadowVisibility = View.GONE;
} else {
shadowVisibility = View.VISIBLE;
if (selectedAccount.equalsIgnoreCase(account)) {
shadowVisibility = View.GONE;
}
}
view.findViewById(R.id.account_unselected_shadow).setVisibility(shadowVisibility);
StatusMode statusMode = AccountManager.getInstance().getAccount(account).getDisplayStatusMode();
int offlineShadowVisibility;
if (statusMode == StatusMode.connection || statusMode == StatusMode.unavailable) {
offlineShadowVisibility = View.VISIBLE;
} else {
offlineShadowVisibility = View.GONE;
}
view.findViewById(R.id.account_offline_shadow).setVisibility(offlineShadowVisibility);
}
}
Aggregations