Search in sources :

Example 1 with GroupConfiguration

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

the class ContactListFragment method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    BaseEntity baseEntity = (BaseEntity) listView.getItemAtPosition(info.position);
    if (baseEntity instanceof AbstractContact) {
        ContextMenuHelper.createContactContextMenu(getActivity(), adapter, (AbstractContact) baseEntity, menu);
    } else if (baseEntity instanceof AccountConfiguration) {
        ContextMenuHelper.createAccountContextMenu(getActivity(), adapter, baseEntity.getAccount(), menu);
    } else if (baseEntity instanceof GroupConfiguration) {
        ContextMenuHelper.createGroupContextMenu(getActivity(), adapter, baseEntity.getAccount(), baseEntity.getUser(), menu);
    } else {
        throw new IllegalStateException();
    }
}
Also used : AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) BaseEntity(com.xabber.android.data.entity.BaseEntity) AccountConfiguration(com.xabber.android.ui.adapter.AccountConfiguration) GroupConfiguration(com.xabber.android.ui.adapter.GroupConfiguration) AbstractContact(com.xabber.android.data.roster.AbstractContact)

Aggregations

AdapterContextMenuInfo (android.widget.AdapterView.AdapterContextMenuInfo)1 BaseEntity (com.xabber.android.data.entity.BaseEntity)1 AbstractContact (com.xabber.android.data.roster.AbstractContact)1 AccountConfiguration (com.xabber.android.ui.adapter.AccountConfiguration)1 GroupConfiguration (com.xabber.android.ui.adapter.GroupConfiguration)1