Java Code Examples for android.widget.ExpandableListView#ExpandableListContextMenuInfo
The following examples show how to use
android.widget.ExpandableListView#ExpandableListContextMenuInfo .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecentTabsPage.java From delion with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // Would prefer to have this context menu view managed internal to RecentTabsGroupView // Unfortunately, setting either onCreateContextMenuListener or onLongClickListener // disables the native onClick (expand/collapse) behaviour of the group view. ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { mAdapter.getGroup(groupPosition).onCreateContextMenuForGroup(menu, mActivity); } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); mAdapter.getGroup(groupPosition).onCreateContextMenuForChild(childPosition, menu, mActivity); } }
Example 2
Source File: RecentTabsPage.java From AndroidChromium with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // Would prefer to have this context menu view managed internal to RecentTabsGroupView // Unfortunately, setting either onCreateContextMenuListener or onLongClickListener // disables the native onClick (expand/collapse) behaviour of the group view. ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { mAdapter.getGroup(groupPosition).onCreateContextMenuForGroup(menu, mActivity); } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); mAdapter.getGroup(groupPosition).onCreateContextMenuForChild(childPosition, menu, mActivity); } }
Example 3
Source File: RecentTabsPage.java From 365browser with Apache License 2.0 | 6 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { // Would prefer to have this context menu view managed internal to RecentTabsGroupView // Unfortunately, setting either onCreateContextMenuListener or onLongClickListener // disables the native onClick (expand/collapse) behaviour of the group view. ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { mAdapter.getGroup(groupPosition).onCreateContextMenuForGroup(menu, mActivity); } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); mAdapter.getGroup(groupPosition).onCreateContextMenuForChild(childPosition, menu, mActivity); } }
Example 4
Source File: FilterFriendsChooseLeadersFragment.java From PADListener with GNU General Public License v2.0 | 6 votes |
@Override public boolean onContextItemSelected(MenuItem menuItem) { MyLog.entry("menuItem = " + menuItem); final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuItem.getMenuInfo(); final int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition); //final MonsterInfoModel monsterInfo = getGroupMonsterItem(menuItem.getMenuInfo()); switch (menuItem.getItemId()) { case MENU_ID_SELECT_ALL: mAdapter.flagAllChildren(groupPosition, true); break; case MENU_ID_DESELECT_ALL: mAdapter.flagAllChildren(groupPosition, false); break; default: } MyLog.exit(); return true; }
Example 5
Source File: ChooseSyncGroupedContextMenuHelper.java From PADListener with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("unchecked") private List<ChooseModelContainer<SyncedMonsterModel>> getGroupChildMonsterItems(ContextMenu.ContextMenuInfo menuInfo) { MyLog.entry("menuInfo = " + menuInfo); final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; final int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition); final List<ChooseModelContainer<SyncedMonsterModel>> monsterItems = new ArrayList<ChooseModelContainer<SyncedMonsterModel>>(); final int childCount = adapter.getChildrenCount(groupPosition); for (int i = 0; i < childCount; i++) { final ChooseModelContainer<SyncedMonsterModel> monsterItem = adapter.getChild(groupPosition, i); monsterItems.add(monsterItem); } MyLog.exit(); return monsterItems; }
Example 6
Source File: FilterFriendsChooseLeadersFragment.java From PADListener with GNU General Public License v2.0 | 5 votes |
private MonsterInfoModel getGroupMonsterItem(ContextMenu.ContextMenuInfo menuInfo) { MyLog.entry("menuInfo = " + menuInfo); final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; final int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition); final MonsterInfoModel result = mAdapter.getGroup(groupPosition); MyLog.exit(); return result; }
Example 7
Source File: ChooseSyncGroupedContextMenuHelper.java From PADListener with GNU General Public License v2.0 | 5 votes |
private MonsterInfoModel getGroupMonsterItem(ContextMenu.ContextMenuInfo menuInfo) { MyLog.entry("menuInfo = " + menuInfo); final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; final int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition); final MonsterInfoModel result = adapter.getGroup(groupPosition); MyLog.exit(); return result; }
Example 8
Source File: ChooseSyncGroupedContextMenuHelper.java From PADListener with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private ChooseModelContainer<SyncedMonsterModel> getChildMonsterItem(ContextMenu.ContextMenuInfo menuInfo) { MyLog.entry("menuInfo = " + menuInfo); final ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int groupPosition = ExpandableListView.getPackedPositionGroup(listItem.packedPosition); int childPosition = ExpandableListView.getPackedPositionChild(listItem.packedPosition); final ChooseModelContainer result = adapter.getChild(groupPosition, childPosition); MyLog.exit(); return result; }
Example 9
Source File: DisplayLightNovelDetailsFragment.java From coolreader with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; MenuInflater inflater = getSherlockActivity().getMenuInflater(); int type = ExpandableListView.getPackedPositionType(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { inflater.inflate(R.menu.novel_details_volume_context_menu, menu); } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { inflater.inflate(R.menu.novel_details_chapter_context_menu, menu); } }
Example 10
Source File: DisplayLightNovelDetailsActivity.java From coolreader with MIT License | 5 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; MenuInflater inflater = getMenuInflater(); int type = ExpandableListView.getPackedPositionType(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) { inflater.inflate(R.menu.novel_details_volume_context_menu, menu); } else if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { inflater.inflate(R.menu.novel_details_chapter_context_menu, menu); } }
Example 11
Source File: ChooseSyncGroupedContextMenuHelper.java From PADListener with GNU General Public License v2.0 | 4 votes |
private boolean isGroup(ContextMenu.ContextMenuInfo menuInfo) { ExpandableListView.ExpandableListContextMenuInfo listItem = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int childPosition = ExpandableListView.getPackedPositionChild(listItem.packedPosition); return childPosition == -1; }
Example 12
Source File: LeadersListFragment.java From 4pdaClient-plus with Apache License 2.0 | 4 votes |
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo; int type = ExpandableListView.getPackedPositionType(info.packedPosition); int groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition); int childPosition = ExpandableListView.getPackedPositionChild(info.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) { Object o = getAdapter().getChild(groupPosition, childPosition); if (o == null) return; final LeadUser leadUser = ((LeadUser) o); final List<MenuListDialog> list = new ArrayList<>(); list.add(new MenuListDialog(App.getInstance().getString(R.string.list_forums), () -> { if (leadUser.isAllForumsOwner()) { MainActivity.showListFragment(new ForumBrickInfo().getName(), null); } else { CharSequence[] forumTitles = new CharSequence[leadUser.getForums().size()]; int i = 0; for (Forum f : leadUser.getForums()) { forumTitles[i++] = f.getTitle(); } Context context = getContext(); if (context != null) new MaterialDialog.Builder(context) .title(R.string.forums) .items(forumTitles) .itemsCallbackSingleChoice(-1, (dialog, view, i1, forumTitles1) -> { ForumTopicsListFragment.showForumTopicsList( leadUser.getForums().get(i1).getId(), leadUser.getForums().get(i1).getTitle()); return true; // allow selection }) .show(); } })); ForumUser.onCreateContextMenu(getContext(), list, leadUser.getId().toString(), leadUser.getNick().toString()); ExtUrl.showContextDialog(getContext(), null, list); } }