Search in sources :

Example 66 with AccountJid

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;
}
Also used : AccountItem(com.xabber.android.data.account.AccountItem) AccountJid(com.xabber.android.data.entity.AccountJid)

Example 67 with AccountJid

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;
    }
}
Also used : AccountJid(com.xabber.android.data.entity.AccountJid) IFlexible(eu.davidea.flexibleadapter.items.IFlexible) ContactVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO) UserJid(com.xabber.android.data.entity.UserJid) AbstractContact(com.xabber.android.data.roster.AbstractContact) GroupVO(com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO)

Example 68 with AccountJid

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);
    }
}
Also used : AccountJid(com.xabber.android.data.entity.AccountJid) IFlexible(eu.davidea.flexibleadapter.items.IFlexible) ContactVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO) UserJid(com.xabber.android.data.entity.UserJid) Intent(android.content.Intent)

Example 69 with AccountJid

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);
}
Also used : StatusMode(com.xabber.android.data.account.StatusMode) AccountItem(com.xabber.android.data.account.AccountItem) AccountJid(com.xabber.android.data.entity.AccountJid) Drawable(android.graphics.drawable.Drawable) ShowOfflineMode(com.xabber.android.data.roster.ShowOfflineMode)

Example 70 with AccountJid

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);
}
Also used : StatusMode(com.xabber.android.data.account.StatusMode) AccountItem(com.xabber.android.data.account.AccountItem) AccountJid(com.xabber.android.data.entity.AccountJid)

Aggregations

AccountJid (com.xabber.android.data.entity.AccountJid)74 UserJid (com.xabber.android.data.entity.UserJid)38 AccountItem (com.xabber.android.data.account.AccountItem)21 Jid (org.jxmpp.jid.Jid)13 Intent (android.content.Intent)11 ArrayList (java.util.ArrayList)11 View (android.view.View)10 NetworkException (com.xabber.android.data.NetworkException)9 AbstractChat (com.xabber.android.data.message.AbstractChat)7 Message (org.jivesoftware.smack.packet.Message)7 Presence (org.jivesoftware.smack.packet.Presence)7 ExtensionElement (org.jivesoftware.smack.packet.ExtensionElement)6 TextView (android.widget.TextView)5 StatusMode (com.xabber.android.data.account.StatusMode)5 Resourcepart (org.jxmpp.jid.parts.Resourcepart)5 ImageView (android.widget.ImageView)4 AccountManager (com.xabber.android.data.account.AccountManager)4 RosterContact (com.xabber.android.data.roster.RosterContact)4 ContactVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO)4 BarPainter (com.xabber.android.ui.color.BarPainter)4