本文整理汇总了Java中android.widget.ExpandableListView.ExpandableListContextMenuInfo类的典型用法代码示例。如果您正苦于以下问题:Java ExpandableListContextMenuInfo类的具体用法?Java ExpandableListContextMenuInfo怎么用?Java ExpandableListContextMenuInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpandableListContextMenuInfo类属于android.widget.ExpandableListView包,在下文中一共展示了ExpandableListContextMenuInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, 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_CHILD) {
HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
menu.setHeaderTitle(item.getTitle());
menu.add(0, MENU_OPEN_IN_TAB, 0, R.string.HistoryListActivity_MenuOpenInTab);
menu.add(0, MENU_COPY_URL, 0, R.string.BookmarksHistoryActivity_MenuCopyLinkUrl);
menu.add(0, MENU_SHARE, 0, R.string.Main_MenuShareLinkUrl);
menu.add(0, MENU_DELETE_FROM_HISTORY, 0, R.string.HistoryListActivity_MenuDelete);
}
}
示例2: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, 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_CHILD) {
HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
menu.setHeaderTitle(item.getTitle());
menu.add(0, MENU_OPEN_IN_TAB, 0, R.string.HistoryListActivity_MenuOpenInTab);
menu.add(0, MENU_COPY_URL, 0, R.string.BookmarksHistoryActivity_MenuCopyLinkUrl);
menu.add(0, MENU_SHARE, 0, R.string.Main_MenuShareLinkUrl);
menu.add(0, MENU_DELETE_FROM_HISTORY, 0, R.string.HistoryListActivity_MenuDelete);
}
}
示例3: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
menu.add(Menu.NONE, 0, Menu.NONE, R.string.context_action_shortcut);
menu.add(Menu.NONE, 1, Menu.NONE, R.string.context_action_launch);
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo)menuInfo;
ExpandableListView list = (ExpandableListView) getView().findViewById(R.id.expandableListView1);
switch(ExpandableListView.getPackedPositionType(info.packedPosition)) {
case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
menu.setHeaderIcon(activity.icon);
menu.setHeaderTitle(activity.name);
menu.add(Menu.NONE, 2, Menu.NONE, R.string.context_action_edit);
break;
case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition));
menu.setHeaderIcon(pack.icon);
menu.setHeaderTitle(pack.name);
break;
}
super.onCreateContextMenu(menu, v, menuInfo);
}
示例4: onContextItemSelected
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();
int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition);
Recording r = (Recording) recAdapter.getChild(groupPos, childPos);
switch (item.getItemId()) {
case R.id.action_edit:
editRecording(r);
return true;
case R.id.action_delete:
deleteRecording(r);
return true;
default:
return super.onContextItemSelected(item);
}
}
示例5: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
String aHeaderTitle = "";
switch (ExpandableListView.getPackedPositionType(info.packedPosition))
{
case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
aHeaderTitle = (String) this.listAdapter.getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition)).toString();
break;
case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
aHeaderTitle = (String) this.listAdapter.getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition)).toString();
break;
default:
break;
}
menu.setHeaderTitle(aHeaderTitle.toString());
menu.add(0, CONTEXT_MENU_EDIT, 0, this.getString(R.string.edit));
menu.add(0, CONTEXT_MENU_DELETE, 0, this.getString(R.string.delete));
}
示例6: onContextItemSelected
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
int child = ExpandableListView.getPackedPositionChild(info.packedPosition);
HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
switch (menuItem.getItemId()) {
case MENU_OPEN_IN_TAB:
doNavigateToUrl(item.getUrl(), true);
break;
case MENU_COPY_URL:
ApplicationUtils.copyTextToClipboard(this, item.getUrl(),
getString(R.string.Commons_UrlCopyToastMessage));
break;
case MENU_SHARE:
ApplicationUtils.sharePage(this, item.getTitle(), item.getUrl());
break;
case MENU_DELETE_FROM_HISTORY:
BookmarksProviderWrapper.deleteHistoryRecord(getContentResolver(), item.getId());
fillData();
break;
default:
break;
}
}
return super.onContextItemSelected(menuItem);
}
示例7: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)
*/
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
if (menuInfo instanceof ExpandableListContextMenuInfo) {
final ExpandableListContextMenuInfo cmi = (ExpandableListContextMenuInfo) menuInfo;
final int type = ExpandableListView.getPackedPositionType(cmi.packedPosition);
final int groupPosition = ExpandableListView.getPackedPositionGroup(cmi.packedPosition);
final int childPosition = ExpandableListView.getPackedPositionChild(cmi.packedPosition);
// System.out.println("OPDSActivity.onCreateContextMenu(): " + type + ", " + groupPosition + ", "
// + childPosition);
switch (type) {
case ExpandableListView.PACKED_POSITION_TYPE_NULL:
onCreateContextMenu(menu);
return;
case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
final Entry entry = getController().adapter.getGroup(groupPosition);
if (entry instanceof Feed) {
onCreateFeedContextMenu(menu, (Feed) entry);
} else if (entry instanceof Book) {
onCreateBookContextMenu(menu, (Book) entry);
}
return;
case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
final Entry group = getController().adapter.getGroup(groupPosition);
final Object child = getController().adapter.getChild(groupPosition, childPosition);
if (child instanceof Link) {
onCreateLinkContextMenu(menu, (Book) group, (Link) child);
} else if (child instanceof Feed) {
onCreateFacetContextMenu(menu, (Feed) group, (Feed) child);
}
return;
}
}
onCreateContextMenu(menu);
}
示例8: onContextItemSelected
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
int child = ExpandableListView.getPackedPositionChild(info.packedPosition);
HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
switch (menuItem.getItemId()) {
case MENU_OPEN_IN_TAB:
doNavigateToUrl(item.getUrl(), true);
break;
case MENU_COPY_URL:
ApplicationUtils.copyTextToClipboard(this, item.getUrl(), getString(R.string.Commons_UrlCopyToastMessage));
break;
case MENU_SHARE:
ApplicationUtils.sharePage(this, item.getTitle(), item.getUrl());
break;
case MENU_DELETE_FROM_HISTORY:
BookmarksProviderWrapper.deleteHistoryRecord(getContentResolver(), item.getId());
fillData();
break;
default:
break;
}
}
return super.onContextItemSelected(menuItem);
}
示例9: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
//only show context menu for child items (recordings not dates)
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.list_recordings_context, menu);
}
}
示例10: onContextItemSelected
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();
int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition);
int type = ExpandableListView.getPackedPositionType(info.packedPosition);
long taskId;
if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
taskId = listHeader.get(groupPos).getId();
} else {
taskId = listItems.get(listHeader.get(groupPos)).get(childPos).getId();
}
switch (item.getItemId()) {
case R.id.action_edit:
editTask(taskId);
return true;
case R.id.action_delete:
deleteTask(taskId);
return true;
case R.id.action_statistics:
statisticsTask(taskId);
return true;
default:
return super.onContextItemSelected(item);
}
}
示例11: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenu.ContextMenuInfo menuInfo) {
ExpandableListView.ExpandableListContextMenuInfo info;
try {
info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
} catch (ClassCastException e) {
Log.e(TAG, "bad menuinfo: ", e);
return;
}
long packedPosition = info.packedPosition;
boolean isChild = isChild(packedPosition);
// get the entry name for the item
String menuName;
if (isChild) {
getMenuInflater().inflate(R.menu.roster_item_contextmenu, menu);
menuName = String.format("%s (%s)",
getPackedItemRow(packedPosition, RosterConstants.ALIAS),
getPackedItemRow(packedPosition, RosterConstants.JID));
} else {
menuName = getPackedItemRow(packedPosition, RosterConstants.GROUP);
if (menuName.equals(""))
return; // no options for default menu
getMenuInflater().inflate(R.menu.roster_group_contextmenu, menu);
}
menu.setHeaderTitle(getString(R.string.roster_contextmenu_title, menuName));
}
示例12: onCreateContextMenu
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
int type = ExpandableListView
.getPackedPositionType(info.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
new MenuInflater(getContext()).inflate(R.menu.workspace_browser, menu);
}
}
示例13: handleLongClick
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void handleLongClick(MenuItem item) {
ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item
.getMenuInfo();
Log.d("CodeMap", "handlelongclick!");
int type = ExpandableListView
.getPackedPositionType(info.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
int groupPosition = ExpandableListView
.getPackedPositionGroup(info.packedPosition);
String group = adapter.getGroup(groupPosition);
Toast.makeText(getContext(), "Clicked! " + group, Toast.LENGTH_SHORT).show();
}
}
示例14: populateList
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void populateList() {
ExpandableListView listView = (ExpandableListView) findViewById(R.id.channelListView);
adapter = new ExpandableListChannelAdapter(this);
listView.setAdapter(adapter);
listView.setOnChildClickListener(this);
listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
ExpandableListContextMenuInfo elcm = (ExpandableListContextMenuInfo) menuInfo;
int type = ExpandableListView.getPackedPositionType(elcm.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int groupPosition = ExpandableListView.getPackedPositionGroup(elcm.packedPosition);
int childPosition = ExpandableListView.getPackedPositionChild(elcm.packedPosition);
String channel = adapter.children[groupPosition][childPosition];
menu.setHeaderTitle(channel);
menu.add(0, 0, 0, R.string.ctx_clear);
if (channel.startsWith("#")){
menu.add(0, 1, 0, R.string.ctx_part);
}
menu.add(0, 2, 0 , R.string.ctx_close);
menu.add(0, 3, 0, R.string.ctx_activatespeech);
}else{
menu.setHeaderTitle(adapter.groupNames[ExpandableListView.getPackedPositionGroup(elcm.packedPosition)]);
menu.add(0, 0, 0, R.string.ctx_viewlog);
menu.add(0, 1, 0, R.string.ctx_clear);
menu.add(0, 2, 0, R.string.ctx_disconnect);
menu.add(0, 3, 0, R.string.ctx_close);
menu.add(0, 4, 0, R.string.ctx_activatespeech);
}
}
});
}
示例15: populateList
import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void populateList() {
ExpandableListView listView = (ExpandableListView) findViewById(R.id.accountListView);
//ListView listView = new ListView(this);
adapter = new ExpandableListORMAccountAdapter(this);
adapter.setData(ExpandableListORMAccountAdapter.AdapterBundle.getAdapterBundle());
listView.setAdapter(adapter);
listView.setOnChildClickListener(this);
listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
ExpandableListContextMenuInfo elcm = (ExpandableListContextMenuInfo) menuInfo;
int type = ExpandableListView.getPackedPositionType(elcm.packedPosition);
if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
int groupPosition = ExpandableListView.getPackedPositionGroup(elcm.packedPosition);
int childPosition = ExpandableListView.getPackedPositionChild(elcm.packedPosition);
menu.setHeaderTitle(R.string.ctx_title_channelmenu);
menu.add(0, 3, 0, R.string.ctx_viewmessages);
menu.add(0, 0, 1, R.string.ctx_part);
menu.add(0, 1, 2, R.string.ctx_edit);
menu.add(0, 2, 3, R.string.ctx_delete);
}
else {
menu.setHeaderTitle(R.string.ctx_title_servermenu);
menu.add(0, 0, 0, R.string.ctx_addchannel);
menu.add(0, 1, 0, R.string.ctx_connect);
menu.add(0, 2, 0, R.string.ctx_disconnect);
menu.add(0, 3, 0, R.string.ctx_edit);
menu.add(0, 4, 0, R.string.ctx_delete);
}}
});
}