Search in sources :

Example 6 with GroupConfiguration

use of com.xabber.android.ui.adapter.contactlist.GroupConfiguration in project xabber-android by redsolution.

the class ContactListPresenter method getTwoNextRecentChat.

public ArrayList<IFlexible> getTwoNextRecentChat() {
    Collection<AbstractChat> chats = MessageManager.getInstance().getChatsOfEnabledAccount();
    GroupConfiguration chatsGroup = getChatsGroup(chats, currentChatsState);
    ArrayList<AbstractContact> contacts = (ArrayList<AbstractContact>) chatsGroup.getAbstractContacts();
    ArrayList<IFlexible> items = new ArrayList<>();
    if (contacts != null && contacts.size() >= MAX_RECENT_ITEMS) {
        items.add(ChatVO.convert(contacts.get(MAX_RECENT_ITEMS - 2), this, null));
        if (getAllChatsSize() > MAX_RECENT_ITEMS)
            items.add(ChatWithButtonVO.convert(contacts.get(MAX_RECENT_ITEMS - 1), this));
        else
            items.add(ChatVO.convert(contacts.get(MAX_RECENT_ITEMS - 1), this));
    }
    return items;
}
Also used : AbstractChat(com.xabber.android.data.message.AbstractChat) ArrayList(java.util.ArrayList) IFlexible(eu.davidea.flexibleadapter.items.IFlexible) GroupConfiguration(com.xabber.android.ui.adapter.contactlist.GroupConfiguration) AbstractContact(com.xabber.android.data.roster.AbstractContact)

Aggregations

GroupConfiguration (com.xabber.android.ui.adapter.contactlist.GroupConfiguration)6 AbstractChat (com.xabber.android.data.message.AbstractChat)4 AbstractContact (com.xabber.android.data.roster.AbstractContact)4 ArrayList (java.util.ArrayList)3 GroupVO (com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO)2 IFlexible (eu.davidea.flexibleadapter.items.IFlexible)2 AccountItem (com.xabber.android.data.account.AccountItem)1 CommonState (com.xabber.android.data.account.CommonState)1 MessageItem (com.xabber.android.data.database.messagerealm.MessageItem)1 AccountJid (com.xabber.android.data.entity.AccountJid)1 UserJid (com.xabber.android.data.entity.UserJid)1 RoomChat (com.xabber.android.data.extension.muc.RoomChat)1 RoomContact (com.xabber.android.data.extension.muc.RoomContact)1 ChatContact (com.xabber.android.data.message.ChatContact)1 RosterContact (com.xabber.android.data.roster.RosterContact)1 AccountWithButtonsVO (com.xabber.android.presentation.ui.contactlist.viewobjects.AccountWithButtonsVO)1 AccountWithGroupsVO (com.xabber.android.presentation.ui.contactlist.viewobjects.AccountWithGroupsVO)1 ButtonVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ButtonVO)1 CategoryVO (com.xabber.android.presentation.ui.contactlist.viewobjects.CategoryVO)1 ChatWithButtonVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ChatWithButtonVO)1