use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class XabberAccountManager method isAccountSynchronize.
public boolean isAccountSynchronize(String jid) {
boolean syncNotAllowed = false;
AccountJid accountJid = getExistingAccount(jid);
if (accountJid != null) {
AccountItem accountItem = AccountManager.getInstance().getAccount(accountJid);
if (accountItem != null)
syncNotAllowed = accountItem.isSyncNotAllowed();
}
if (accountsSyncState.containsKey(jid) && !syncNotAllowed)
return accountsSyncState.get(jid);
else
return false;
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ContactListFragment method onItemContextMenu.
@Override
public void onItemContextMenu(int adapterPosition, ContextMenu menu) {
IFlexible item = adapter.getItem(adapterPosition);
if (item != null && item instanceof ContactVO) {
AccountJid accountJid = ((ContactVO) item).getAccountJid();
UserJid userJid = ((ContactVO) item).getUserJid();
AbstractContact abstractContact = RosterManager.getInstance().getAbstractContact(accountJid, userJid);
ContextMenuHelper.createContactContextMenu(getActivity(), presenter, abstractContact, menu);
return;
}
if (item != null && item instanceof GroupVO) {
AccountJid accountJid = ((GroupVO) item).getAccountJid();
ContextMenuHelper.createGroupContextMenu(getActivity(), presenter, accountJid, ((GroupVO) item).getGroupName(), menu);
return;
}
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ContactListFragment method onContactAvatarClick.
@Override
public void onContactAvatarClick(int adapterPosition) {
IFlexible item = adapter.getItem(adapterPosition);
if (item != null && item instanceof ContactVO) {
Intent intent;
AccountJid accountJid = ((ContactVO) item).getAccountJid();
UserJid userJid = ((ContactVO) item).getUserJid();
if (MUCManager.getInstance().hasRoom(accountJid, userJid)) {
intent = ContactActivity.createIntent(getActivity(), accountJid, userJid);
} else {
intent = ContactEditActivity.createIntent(getActivity(), accountJid, userJid);
}
getActivity().startActivity(intent);
}
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class AccountVO method convert.
public static AccountVO convert(AccountConfiguration configuration, AccountClickListener listener) {
String jid;
String name;
String status;
int statusLevel;
int statusId;
Drawable avatar;
int offlineModeLevel;
boolean showOfflineShadow = false;
int accountColorIndicator;
int accountColorIndicatorBack;
String contactCount;
AccountJid account = configuration.getAccount();
accountColorIndicator = ColorManager.getInstance().getAccountPainter().getAccountMainColor(account);
accountColorIndicatorBack = ColorManager.getInstance().getAccountPainter().getAccountIndicatorBackColor(account);
jid = GroupManager.getInstance().getGroupName(account, configuration.getGroup());
name = AccountManager.getInstance().getNickName(account);
contactCount = configuration.getOnline() + "/" + configuration.getTotal();
AccountItem accountItem = AccountManager.getInstance().getAccount(account);
status = accountItem.getStatusText().trim();
statusId = accountItem.getDisplayStatusMode().getStringID();
avatar = AvatarManager.getInstance().getAccountAvatar(account);
statusLevel = accountItem.getDisplayStatusMode().getStatusLevel();
ShowOfflineMode showOfflineMode = configuration.getShowOfflineMode();
if (showOfflineMode == ShowOfflineMode.normal) {
if (SettingsManager.contactsShowOffline()) {
showOfflineMode = ShowOfflineMode.always;
} else {
showOfflineMode = ShowOfflineMode.never;
}
}
offlineModeLevel = showOfflineMode.ordinal();
StatusMode statusMode = accountItem.getDisplayStatusMode();
if (statusMode == StatusMode.unavailable || statusMode == StatusMode.connection) {
showOfflineShadow = true;
} else {
showOfflineShadow = false;
}
return new AccountVO(accountColorIndicator, accountColorIndicatorBack, showOfflineShadow, name, jid, status, statusLevel, statusId, avatar, offlineModeLevel, contactCount, configuration.getAccount(), configuration.isExpanded(), configuration.getGroup(), listener);
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ButtonVO method convert.
public static ButtonVO convert(@Nullable AccountConfiguration configuration, String title, String action) {
boolean showOfflineShadow = false;
int accountColorIndicator = ColorManager.getInstance().getAccountPainter().getDefaultMainColor();
AccountJid account = null;
if (configuration != null) {
account = configuration.getAccount();
accountColorIndicator = ColorManager.getInstance().getAccountPainter().getAccountMainColor(account);
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 ButtonVO(accountColorIndicator, showOfflineShadow, title, action, account);
}
Aggregations