use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class GroupVO method convert.
public static GroupVO convert(GroupConfiguration configuration, boolean firstInAccount, GroupClickListener listener) {
String name = GroupManager.getInstance().getGroupName(configuration.getAccount(), configuration.getGroup());
boolean showOfflineShadow = false;
int accountColorIndicator;
int accountColorIndicatorBack;
boolean expanded;
int offlineIndicatorLevel;
AccountJid account = configuration.getAccount();
if (account == null || account == GroupManager.NO_ACCOUNT) {
accountColorIndicator = ColorManager.getInstance().getAccountPainter().getDefaultMainColor();
accountColorIndicatorBack = ColorManager.getInstance().getAccountPainter().getDefaultIndicatorBackColor();
} else {
accountColorIndicator = ColorManager.getInstance().getAccountPainter().getAccountMainColor(account);
accountColorIndicatorBack = ColorManager.getInstance().getAccountPainter().getAccountIndicatorBackColor(account);
}
expanded = configuration.isExpanded();
offlineIndicatorLevel = configuration.getShowOfflineMode().ordinal();
if (!name.equals(RECENT_CHATS_TITLE))
name = String.format("%s (%d/%d)", name, configuration.getOnline(), configuration.getTotal());
AccountItem accountItem = AccountManager.getInstance().getAccount(configuration.getAccount());
if (accountItem != null) {
StatusMode statusMode = accountItem.getDisplayStatusMode();
if (statusMode == StatusMode.unavailable || statusMode == StatusMode.connection)
showOfflineShadow = true;
}
return new GroupVO(accountColorIndicator, accountColorIndicatorBack, showOfflineShadow, name, expanded, offlineIndicatorLevel, configuration.getGroup(), configuration.getAccount(), firstInAccount, listener);
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class AccountManager method getEnabledAccounts.
/**
* @return List of enabled accounts.
*/
public Collection<AccountJid> getEnabledAccounts() {
List<AccountJid> enabledAccounts = new ArrayList<>();
for (AccountItem accountItem : accountItems.values()) {
if (accountItem.isEnabled()) {
AccountJid accountJid = accountItem.getAccount();
accountJid.setOrder(accountItem.getOrder());
enabledAccounts.add(accountJid);
}
}
return Collections.unmodifiableCollection(enabledAccounts);
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class AccountManager method getSelectedAccount.
/**
* @return Selected account to show contacts. <code>null</code> if
* <ul>
* <li>there is no selected account,</li>
* <li>selected account does not exists or disabled,</li>
* <li>Group by account is enabled.</li>
* </ul>
*/
public AccountJid getSelectedAccount() {
if (SettingsManager.contactsShowAccounts()) {
return null;
}
if (TextUtils.isEmpty(SettingsManager.contactsSelectedAccount())) {
return null;
}
AccountJid selected;
try {
selected = AccountJid.from(SettingsManager.contactsSelectedAccount());
} catch (XmppStringprepException e) {
LogManager.exception(this, e);
return null;
}
AccountItem selectedAccountItem = accountItems.get(selected);
if (selectedAccountItem != null && selectedAccountItem.isEnabled()) {
return selected;
}
return null;
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ConnectionManager method connectAll.
public void connectAll() {
LogManager.i(LOG_TAG, "connectAll");
AccountManager accountManager = AccountManager.getInstance();
for (AccountJid account : accountManager.getEnabledAccounts()) {
ReconnectionManager.getInstance().requestReconnect(account);
}
}
Aggregations