Example usage for android.widget ExpandableListView getPackedPositionType

List of usage examples for android.widget ExpandableListView getPackedPositionType

Introduction

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

Prototype

public static int getPackedPositionType(long packedPosition) 

Source Link

Document

Gets the type of a packed position.

Usage

From source file:com.money.manager.ex.common.CategoryListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        menu.setHeaderTitle(mCategories.get(group).getName());
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        QueryCategorySubCategory subCategory = mSubCategories.get(mCategories.get(group)).get(child);
        menu.setHeaderTitle(//from ww  w  .  j av a2  s  .com
                subCategory.getCategName().toString() + ": " + subCategory.getSubcategoryName().toString());
    }

    // context menu from resource
    menu.add(Menu.NONE, ContextMenuIds.EDIT.getId(), Menu.NONE, getString(R.string.edit));
    menu.add(Menu.NONE, ContextMenuIds.DELETE.getId(), Menu.NONE, getString(R.string.delete));
    menu.add(Menu.NONE, ContextMenuIds.VIEW_TRANSACTIONS.getId(), Menu.NONE,
            getString(R.string.view_transactions));
}

From source file:com.login.home.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
    String title = ((TextView) info.targetView).getText().toString();
    menu.setHeaderTitle(title);//from  ww  w  .  j  a va2s .c om

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        super.onCreateContextMenu(menu, v, menuInfo);
        int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
        if (groupPos == 1 || groupPos == 0) {
            menu.add(1, 0, 0, "ACCEPT");
            menu.add(1, 1, 0, "DECLINE");
            menu.add(1, 2, 0, "SHOW INFO");
        } else if (groupPos == 2) {
            menu.add(1, 0, 0, "SHOW INFO");
            menu.add(1, 1, 0, "SHOW ON A MAP");
            menu.add(1, 2, 0, "WILL NOT ATTEND");

        }
    }
}

From source file:org.yammp.fragment.ArtistFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) {

    ExpandableListContextMenuInfo mi = (ExpandableListContextMenuInfo) info;

    int itemtype = ExpandableListView.getPackedPositionType(mi.packedPosition);
    mSelectedGroupPosition = ExpandableListView.getPackedPositionGroup(mi.packedPosition);
    int gpos = mSelectedGroupPosition;
    if (itemtype == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {

        mGroupSelected = true;/*w  w  w .  j a va 2  s.c om*/
        mChildSelected = false;
        mGroupCursor.moveToPosition(gpos);
        menu.add(hashCode(), PLAY_SELECTION, 0, R.string.play_selection);
        menu.add(hashCode(), DELETE_ITEMS, 0, R.string.delete_music);
        menu.add(hashCode(), DELETE_LYRICS, 0, R.string.delete_lyrics);
        if (gpos == -1) {
            // this shouldn't happen
            Log.d("Artist/Album", "no group");
            return;
        }
        mCurrentGroupArtistName = mGroupCursor.getString(mGroupArtistIdx);
        mSelectedGroupId = mGroupCursor.getLong(mGroupArtistIdIdx);
        if (mCurrentGroupArtistName != null && !MediaStore.UNKNOWN_STRING.equals(mCurrentGroupArtistName)) {
            menu.setHeaderTitle(mCurrentGroupArtistName);
            menu.add(hashCode(), SEARCH, 0, android.R.string.search_go);
        } else {
            menu.setHeaderTitle(getString(R.string.unknown_artist));
        }
    }
}

From source file:co.nerdart.ourss.fragment.FeedsListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.feed_list_fragment, container, false);

    mListView = (DragNDropExpandableListView) rootView.findViewById(android.R.id.list);
    mListAdapter.setExpandableListView(mListView);
    mListView.setFastScrollEnabled(true);
    mListView.setOnItemLongClickListener(new OnItemLongClickListener() {
        @Override/*from  w ww .java2 s  .c o  m*/
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            String title = ((TextView) view.findViewById(android.R.id.text1)).getText().toString();
            Matcher m = Pattern.compile("(.*) \\([0-9]+\\)$").matcher(title);
            if (m.matches()) {
                title = m.group(1);
            }

            long feedId = mListView.getItemIdAtPosition(position);
            ActionMode actionMode;
            if (view.findViewById(R.id.indicator).getVisibility() == View.VISIBLE) { // This is a group
                actionMode = getActivity().startActionMode(mGroupActionModeCallback);
            } else { // This is a feed
                actionMode = getActivity().startActionMode(mFeedActionModeCallback);
            }
            actionMode.setTag(new Pair<Long, String>(feedId, title));

            mListAdapter.setSelectedFeed(feedId);
            return true;
        }
    });

    mListView.setAdapter(mListAdapter);

    mListView.setOnChildClickListener(new OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                long id) {
            mListAdapter.startFeedActivity(id);
            return false;
        }
    });

    mListView.setDragNDropListener(new DragNDropListener() {
        boolean fromHasGroupIndicator = false;

        @Override
        public void onStopDrag(View itemView) {
        }

        @Override
        public void onStartDrag(View itemView) {
            fromHasGroupIndicator = itemView.findViewById(R.id.indicator).getVisibility() == View.VISIBLE;
        }

        @Override
        public void onDrop(final int flatPosFrom, final int flatPosTo) {
            final boolean fromIsGroup = ExpandableListView.getPackedPositionType(mListView
                    .getExpandableListPosition(flatPosFrom)) == ExpandableListView.PACKED_POSITION_TYPE_GROUP;
            final boolean toIsGroup = ExpandableListView.getPackedPositionType(mListView
                    .getExpandableListPosition(flatPosTo)) == ExpandableListView.PACKED_POSITION_TYPE_GROUP;

            final boolean fromIsFeedWithoutGroup = fromIsGroup && !fromHasGroupIndicator;

            View toView = mListView.getChildAt(flatPosTo - mListView.getFirstVisiblePosition());
            boolean toIsFeedWithoutGroup = toIsGroup
                    && toView.findViewById(R.id.indicator).getVisibility() != View.VISIBLE;

            final long packedPosTo = mListView.getExpandableListPosition(flatPosTo);
            final int packedGroupPosTo = ExpandableListView.getPackedPositionGroup(packedPosTo);

            if ((fromIsFeedWithoutGroup || !fromIsGroup) && toIsGroup && !toIsFeedWithoutGroup) {
                new AlertDialog.Builder(getActivity()) //
                        .setTitle(R.string.to_group_title) //
                        .setMessage(R.string.to_group_message) //
                        .setPositiveButton(R.string.to_group_into, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                ContentValues values = new ContentValues();
                                values.put(FeedColumns.PRIORITY, 1);
                                values.put(FeedColumns.GROUP_ID, mListView.getItemIdAtPosition(flatPosTo));

                                ContentResolver cr = getActivity().getContentResolver();
                                cr.update(FeedColumns.CONTENT_URI(mListView.getItemIdAtPosition(flatPosFrom)),
                                        values, null, null);
                                cr.notifyChange(FeedColumns.GROUPS_CONTENT_URI, null);
                            }
                        }).setNegativeButton(R.string.to_group_above, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                moveItem(fromIsGroup, toIsGroup, fromIsFeedWithoutGroup, packedPosTo,
                                        packedGroupPosTo, flatPosFrom);
                            }
                        }).show();
            } else {
                moveItem(fromIsGroup, toIsGroup, fromIsFeedWithoutGroup, packedPosTo, packedGroupPosTo,
                        flatPosFrom);
            }
        }

        @Override
        public void onDrag(int x, int y, ListView listView) {
        }
    });

    return rootView;
}

From source file:com.login.home.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
        int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition);
        @SuppressWarnings("unchecked")
        HashMap<String, String> o = (HashMap<String, String>) mAdapter.getChild(groupPos, childPos);
        SharedPreferences settings = getSharedPreferences("pref_meetmethere", 0);
        ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
        String log = settings.getString("login", "error");
        String pass = settings.getString("password", "error");
        postParameters.add(new BasicNameValuePair("login", log));
        postParameters.add(new BasicNameValuePair("password", pass));
        postParameters.add(new BasicNameValuePair("id", o.get("id")));
        if (groupPos == 1 || groupPos == 0) {
            switch (item.getItemId()) {
            case 0:
                postParameters.add(new BasicNameValuePair("confirmed", "1"));
                break;
            case 1:
                postParameters.add(new BasicNameValuePair("confirmed", "2"));
                break;
            case 2:
                if (groupPos == 0) {
                    Intent intent = new Intent(home.this, event_info.class);
                    intent.putExtra("longitude", o.get("longitude"));
                    intent.putExtra("latitude", o.get("latitude"));
                    intent.putExtra("willAttend", o.get("willAttend"));
                    intent.putExtra("address", o.get("address"));
                    intent.putExtra("id", o.get("id"));
                    intent.putExtra("title", o.get("title"));
                    intent.putExtra("startdate", o.get("startdate"));
                    intent.putExtra("enddate", o.get("enddate"));
                    intent.putExtra("address", o.get("address"));
                    intent.putExtra("description", o.get("description"));
                    startActivity(intent);
                } else if (groupPos == 1) {
                    String friend = o.get("login");
                    Intent intent = new Intent(home.this, profile.class);
                    intent.putExtra("friend", friend);
                    intent.putExtra("yourrequest", "true");
                    intent.putExtra("id", o.get("id"));
                    intent.putExtra("confirmed", "0");
                    startActivity(intent);
                }//from w  ww . j  a va2  s.com
                break;
            }

            String response = null;
            try {
                if (groupPos == 1)
                    response = CustomHttpClient.executeHttpPost(
                            "http://antoines.goldzoneweb.info/accept_contact.php", postParameters);
                else
                    response = CustomHttpClient.executeHttpPost(
                            "http://antoines.goldzoneweb.info/accept_event.php", postParameters);

                String res = response.toString();
                res = res.replaceAll("\\s+", "");
                if (res.equals("OK")) {
                    Intent myIntent = new Intent(home.this, home.class);
                    startActivityForResult(myIntent, 0);
                }

            } catch (Exception e) {
                System.out.println("Error occured");
            }
        } else if (groupPos == 2) {
            switch (item.getItemId()) {
            case 0:
                Intent intent = new Intent(home.this, event_info.class);
                intent.putExtra("longitude", o.get("longitude"));
                intent.putExtra("latitude", o.get("latitude"));
                intent.putExtra("willAttend", o.get("willAttend"));
                intent.putExtra("address", o.get("address"));
                intent.putExtra("id", o.get("id"));
                intent.putExtra("title", o.get("title"));
                intent.putExtra("startdate", o.get("startdate"));
                intent.putExtra("enddate", o.get("enddate"));
                intent.putExtra("address", o.get("address"));
                intent.putExtra("description", o.get("description"));
                startActivity(intent);
                break;
            case 1:
                Intent intent2 = new Intent(home.this, mapevent.class);
                intent2.putExtra("longitude", o.get("longitude"));
                intent2.putExtra("latitude", o.get("latitude"));
                intent2.putExtra("willAttend", o.get("willAttend"));
                intent2.putExtra("address", o.get("address"));
                intent2.putExtra("id", o.get("id"));
                intent2.putExtra("title", o.get("title"));
                intent2.putExtra("startdate", o.get("startdate"));
                intent2.putExtra("enddate", o.get("enddate"));
                intent2.putExtra("address", o.get("address"));
                intent2.putExtra("description", o.get("description"));
                startActivity(intent2);
                break;
            case 2:
                postParameters.add(new BasicNameValuePair("confirmed", "2"));
                String response = null;
                try {
                    response = CustomHttpClient.executeHttpPost(
                            "http://antoines.goldzoneweb.info/accept_event.php", postParameters);

                    String res = response.toString();
                    res = res.replaceAll("\\s+", "");
                    if (res.equals("OK")) {
                        Intent myIntent = new Intent(home.this, home.class);
                        startActivityForResult(myIntent, 0);
                    }

                } catch (Exception e) {
                    System.out.println("Error occured");
                }
                break;
            }
        }
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        return true;
    }
    return false;
}

From source file:edu.chalmers.dat255.audiobookplayer.view.BookshelfFragment.java

@SuppressWarnings("rawtypes")
@Override// w ww.  j  av  a  2  s  .com
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    // check that the menuInfo is of the correct type
    // this method is allowed to have quite a high cyclomatic complexity as
    // it would otherwise cause code duplication

    if (menuInfo instanceof ExpandableListContextMenuInfo && adapter != null) {
        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
        // get the provided book position
        int bookIndex = ExpandableListView.getPackedPositionGroup(info.packedPosition);
        // trackIndex will be -1 if group is clicked
        int trackIndex = ExpandableListView.getPackedPositionChild(info.packedPosition);
        // get the type of the context menu
        int type = ExpandableListView.getPackedPositionType(info.packedPosition);
        // create an empty array to prevent trying to loop over an
        // uninitialized variable
        IContextMenuItem[] menuItems = new IContextMenuItem[0];
        String title = "";
        // fill the context menu with the correct items
        if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
            // get all menu items from the child context menu
            menuItems = ChildContextMenuItem.values();
            // set the context menu's title to that of the value of the
            // child
            title = adapter.getChild(bookIndex, trackIndex);

        } else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
            // get all menu items from the group context menu
            menuItems = GroupContextMenuItem.values();
            // set the context menu's title to that of the value of the book
            title = adapter.getGroup(bookIndex);
        }
        // set the title
        menu.setHeaderTitle(title);
        // populate the context menu with items in the order they were
        // declared in the enum declaration.
        for (IContextMenuItem item : menuItems) {
            // as this only loops when menuItems is of either of type
            // GroupContextMenuItem[] or ChildContextMenuItem[], Enum can be
            // used as a raw type
            menu.add(Menu.NONE, ((Enum) item).ordinal(), ((Enum) item).ordinal(), item.getText());
        }
    }
}

From source file:com.money.manager.ex.common.CategoryListFragment.java

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
    ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) item
            .getMenuInfo();//from w  w w .  j  a  va 2  s. c  o m

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

    CategorySub categoryIds = new CategorySub();
    categoryIds.categId = Constants.NOT_SET;
    categoryIds.categName = "";
    categoryIds.subCategId = Constants.NOT_SET;
    categoryIds.subCategName = "";

    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        categoryIds.categId = mCategories.get(group).getId();
        categoryIds.categName = mCategories.get(group).getName();
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        categoryIds.categId = mSubCategories.get(mCategories.get(group)).get(child).getCategId();
        categoryIds.subCategId = mSubCategories.get(mCategories.get(group)).get(child).getSubCategId();
        categoryIds.subCategName = mSubCategories.get(mCategories.get(group)).get(child).getSubcategoryName()
                .toString();
    }
    // manage select menu
    ContextMenuIds menuId = ContextMenuIds.get(item.getItemId());
    switch (menuId) {
    case EDIT:
        if (categoryIds.subCategId == ExpandableListView.INVALID_POSITION) {
            showDialogEditCategoryName(SQLTypeTransaction.UPDATE, categoryIds.categId, categoryIds.categName);
        } else {
            showDialogEditSubCategoryName(SQLTypeTransaction.UPDATE, categoryIds.categId,
                    categoryIds.subCategId, categoryIds.subCategName);
        }
        break;

    case DELETE:
        showDialogDeleteCategorySub(categoryIds);
        break;

    case VIEW_TRANSACTIONS: // view transactions
        SearchParameters parameters = new SearchParameters();
        parameters.category = categoryIds;

        showSearchActivityFor(parameters);
    }
    return false;
}

From source file:org.jitsi.android.gui.contactlist.ContactListFragment.java

/**
 * {@inheritDoc}/*w  ww .j a  va  2 s .c  o m*/
 */
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    if (contactListView.getExpandableListAdapter() != getContactListAdapter()) {
        return;
    }

    ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);

    int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);

    int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

    // Only create a context menu for child items
    MenuInflater inflater = getActivity().getMenuInflater();
    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        createGroupCtxMenu(menu, inflater, group);
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        createContactCtxMenu(menu, inflater, group, child);
    }
}

From source file:edu.chalmers.dat255.audiobookplayer.view.BookshelfFragment.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    if (getActivity() == null) {
        return false;
    }//from  w w w . j a v a  2  s  .c  o m

    // this method is allowed to have quite a high cyclomatic complexity as
    // it would otherwise cause code duplication
    ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();
    // get the provided book position
    int bookIndex = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    // will be -1 if the type is group
    int trackIndex = ExpandableListView.getPackedPositionChild(info.packedPosition);
    // get the type of the context menu
    int type = ExpandableListView.getPackedPositionType(info.packedPosition);

    // create an empty array to prevent trying to loop over an uninitialized
    // variable
    IContextMenuItem[] menuItems = new IContextMenuItem[0];
    // fill the array with the correct items
    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        menuItems = ChildContextMenuItem.values();
    } else if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        menuItems = GroupContextMenuItem.values();
    }

    // get an item and store it with its dynamic type
    IContextMenuItem menuItem = menuItems[item.getItemId()];

    // if the type of the context menu is group
    if (menuItem instanceof GroupContextMenuItem) {

        // perform the correct task
        executeGroupMenuItem((GroupContextMenuItem) menuItem, bookIndex);

    }
    // if the type of the context menu is that of a child
    else if (menuItem instanceof ChildContextMenuItem) {
        // perform the correct task
        executeChildMenuItem((ChildContextMenuItem) menuItem, bookIndex, trackIndex);
    }
    return true;
}

From source file:com.miz.mizuu.fragments.ShowSeasonsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (setBackground && !MizLib.isPortrait(getActivity()) && MizLib.isTablet(getActivity()))
        view.findViewById(R.id.container).setBackgroundColor(Color.parseColor("#101010"));

    pbar = (ProgressBar) view.findViewById(R.id.progressbar);
    if (useGridView)
        mGridView = (StickyGridHeadersGridView) view.findViewById(R.id.gridView);
    else/*from   w  w w . j a va2 s  .  c o  m*/
        mListView = (ExpandableListView) view.findViewById(R.id.listView);

    if (useGridView) {
        mGridView.setAreHeadersSticky(false);
        mGridView.setAdapter(mGridAdapter);
    } else {
        mListView.setAdapter(mListAdapter);
        mListView.setGroupIndicator(null);
    }

    if (useGridView)
        mGridView.setAdapter(mGridAdapter);
    else
        mListView.setAdapter(mListAdapter);

    getCollectionView().setFastScrollEnabled(true);
    getCollectionView().setDrawSelectorOnTop(true);
    getCollectionView().setSelector(R.drawable.buttonstyle);
    if (!useGridView) {
        mListView.setOnChildClickListener(new OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                    long id) {
                int position = getEpisodeNumber(groupPosition, childPosition);

                if (position >= 0) {
                    if (mActionMode != null)
                        mActionMode.finish();

                    if (!isPortrait) {
                        mListView.setItemChecked(MizLib.flatPosition(mListView, groupPosition, childPosition),
                                true);
                        selectedEpisodeIndex = position;
                    }

                    selectEpisode(shownEpisodes.get(position));
                }

                return true;
            }
        });
    } else {
        mGridView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
                if (position >= 0) {
                    if (mActionMode != null)
                        mActionMode.finish();

                    if (!isPortrait) {
                        getCollectionView().setItemChecked(position, true);
                        selectedEpisodeIndex = position;
                    }

                    selectEpisode(shownEpisodes.get(position));
                }
            }
        });
    }
    getCollectionView().setOnItemLongClickListener(new OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
            if (position >= 0) {
                if (!useGridView && ExpandableListView
                        .getPackedPositionType(arg3) == ExpandableListView.PACKED_POSITION_TYPE_GROUP) // This is a group, let's dismiss it
                    return false;

                if (mActionMode != null)
                    return false;

                getCollectionView().setItemChecked(position, true);

                if (!useGridView) {
                    int pos = getEpisodeNumber(ExpandableListView.getPackedPositionGroup(arg3),
                            ExpandableListView
                                    .getPackedPositionChild(mListView.getExpandableListPosition(position)));
                    selectedEpisodeIndex = pos;
                    selectEpisode(shownEpisodes.get(pos));
                } else {
                    selectedEpisodeIndex = position;
                    selectEpisode(shownEpisodes.get(position));
                }
                mActionMode = getActivity().startActionMode(mActionModeCallback);
            }
            return true;
        }
    });

    loadEpisodes(0, true);
}