Search in sources :

Example 1 with ContactVO

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

the class ContactListPresenter method onItemClick.

public void onItemClick(IFlexible item) {
    if (item instanceof ContactVO) {
        AccountJid accountJid = ((ContactVO) item).getAccountJid();
        UserJid userJid = ((ContactVO) item).getUserJid();
        if (view != null)
            view.onContactClick(RosterManager.getInstance().getAbstractContact(accountJid, userJid));
    } else if (item instanceof ButtonVO) {
        ButtonVO button = (ButtonVO) item;
        if (view != null)
            view.onButtonItemClick(button);
    } else if (item instanceof CrowdfundingChatVO) {
        if (view != null) {
            AccountJid accountJid = CrowdfundingChat.getDefaultAccount();
            UserJid userJid = CrowdfundingChat.getDefaultUser();
            if (accountJid != null && userJid != null)
                view.onContactClick(RosterManager.getInstance().getAbstractContact(accountJid, userJid));
        }
    }
}
Also used : ChatWithButtonVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ChatWithButtonVO) ButtonVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ButtonVO) AccountJid(com.xabber.android.data.entity.AccountJid) ExtContactVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ExtContactVO) ContactVO(com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO) UserJid(com.xabber.android.data.entity.UserJid) CrowdfundingChatVO(com.xabber.android.presentation.ui.contactlist.viewobjects.CrowdfundingChatVO)

Example 2 with ContactVO

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

the class RecentChatFragment 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 3 with ContactVO

use of com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO 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 4 with ContactVO

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

AccountJid (com.xabber.android.data.entity.AccountJid)4 UserJid (com.xabber.android.data.entity.UserJid)4 ContactVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ContactVO)4 IFlexible (eu.davidea.flexibleadapter.items.IFlexible)3 Intent (android.content.Intent)2 AbstractContact (com.xabber.android.data.roster.AbstractContact)1 ButtonVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ButtonVO)1 ChatWithButtonVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ChatWithButtonVO)1 CrowdfundingChatVO (com.xabber.android.presentation.ui.contactlist.viewobjects.CrowdfundingChatVO)1 ExtContactVO (com.xabber.android.presentation.ui.contactlist.viewobjects.ExtContactVO)1 GroupVO (com.xabber.android.presentation.ui.contactlist.viewobjects.GroupVO)1