Example usage for android.widget ExpandableListView PACKED_POSITION_TYPE_NULL

List of usage examples for android.widget ExpandableListView PACKED_POSITION_TYPE_NULL

Introduction

In this page you can find the example usage for android.widget ExpandableListView PACKED_POSITION_TYPE_NULL.

Prototype

int PACKED_POSITION_TYPE_NULL

To view the source code for android.widget ExpandableListView PACKED_POSITION_TYPE_NULL.

Click Source Link

Document

The packed position represents a neither/null/no preference.

Usage

From source file:org.ale.scanner.zotero.MainActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getMenuInflater();
    if (menuInfo instanceof ExpandableListContextMenuInfo) {
        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
        int type = ExpandableListView.getPackedPositionType(info.packedPosition);
        int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
        if (type != ExpandableListView.PACKED_POSITION_TYPE_NULL) {
            // It's not in the header
            inflater.inflate(R.menu.bib_item_context_menu, menu);
            menu.setHeaderTitle(mItemAdapter.getTitleOfGroup(group));
        }/*from ww w.  j a v  a2 s .  c  o m*/
    } else if (menuInfo instanceof AdapterContextMenuInfo) {
        if (v.getId() != R.id.pending_item_list) {
            AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
            inflater.inflate(R.menu.pending_item_context_menu, menu);
            menu.setHeaderTitle(mPendingAdapter.getItem(info.position));
        }
    }
}