Search in sources :

Example 1 with GroupVO

use of com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO in project xabber-android by redsolution.

the class ContactListPresenter method createContactListWithGroups.

private void createContactListWithGroups(List<IFlexible> items, boolean showEmptyGroups, Map<String, GroupConfiguration> groups, Comparator<AbstractContact> comparator) {
    for (GroupConfiguration rosterConfiguration : groups.values()) {
        if (showEmptyGroups || !rosterConfiguration.isEmpty()) {
            GroupVO group = GroupVO.convert(rosterConfiguration, false, this);
            rosterConfiguration.sortAbstractContacts(comparator);
            for (AbstractContact contact : rosterConfiguration.getAbstractContacts()) {
                group.addSubItem(SettingsManager.contactsShowMessages() ? ExtContactVO.convert(contact, this) : ContactVO.convert(contact, this));
            }
            items.add(group);
        }
    }
}
Also used : GroupConfiguration(com.xabber.android.ui.adapter.contactlist.GroupConfiguration) AbstractContact(com.xabber.android.data.roster.AbstractContact) GroupVO(com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO)

Example 2 with GroupVO

use of com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO in project xabber-android by redsolution.

the class ContactListPresenter method createContactListWithAccountsAndGroups.

private void createContactListWithAccountsAndGroups(List<IFlexible> items, AccountConfiguration rosterAccount, boolean showEmptyGroups, Comparator<AbstractContact> comparator) {
    AccountWithGroupsVO account = AccountWithGroupsVO.convert(rosterAccount, this);
    boolean firstGroupInAccount = true;
    for (GroupConfiguration rosterConfiguration : rosterAccount.getSortedGroupConfigurations()) {
        if (showEmptyGroups || !rosterConfiguration.isEmpty()) {
            GroupVO group = GroupVO.convert(rosterConfiguration, firstGroupInAccount, this);
            firstGroupInAccount = false;
            rosterConfiguration.sortAbstractContacts(comparator);
            for (AbstractContact contact : rosterConfiguration.getAbstractContacts()) {
                group.addSubItem(SettingsManager.contactsShowMessages() ? ExtContactVO.convert(contact, this) : ContactVO.convert(contact, this));
            }
            account.addSubItem(group);
        }
    }
    items.add(account);
}
Also used : AccountWithGroupsVO(com.xabber.android.presentation.ui.contactlist.viewobjects.AccountWithGroupsVO) GroupConfiguration(com.xabber.android.ui.adapter.contactlist.GroupConfiguration) AbstractContact(com.xabber.android.data.roster.AbstractContact) GroupVO(com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO)

Example 3 with GroupVO

use of com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO 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)

Aggregations

AbstractContact (com.xabber.android.data.roster.AbstractContact)3 GroupVO (com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO)3 GroupConfiguration (com.xabber.android.ui.adapter.contactlist.GroupConfiguration)2 AccountJid (com.xabber.android.data.entity.AccountJid)1 UserJid (com.xabber.android.data.entity.UserJid)1 AccountWithGroupsVO (com.xabber.android.presentation.ui.contactlist.viewobjects.AccountWithGroupsVO)1 ContactVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO)1 IFlexible (eu.davidea.flexibleadapter.items.IFlexible)1