List of usage examples for android.view MenuItem getMenuInfo
public ContextMenuInfo getMenuInfo();
From source file:com.xuejian.client.lxp.module.toolbox.im.ChatHistoryFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_message) { EMContact tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); boolean isGroup = false; if (tobeDeleteUser instanceof EMGroup) isGroup = true;//from w w w . j a v a 2 s .c o m // ? EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername(), isGroup); InviteMsgRepository.deleteInviteMsg(getActivity(), tobeDeleteUser.getUsername()); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); // ? // ((MainActivity) getActivity()).updateUnreadLabel(); return true; } return super.onContextItemSelected(item); }
From source file:org.kaaproject.kaa.demo.smarthousedemo.smarthouse.DevicesFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (getDeviceType().ordinal() == item.getGroupId()) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); final SmartDeviceInfo device = mDevicesAdapter.getItem(info.position); int menuItemIndex = item.getItemId(); switch (menuItemIndex) { case 0:// w ww . j a v a2 s . c o m mActivity.getSmartHouseController().deattachEndpoint(device.getEndpointKey(), new DetachEdnpointCallback(device)); break; case 1: final String previousDeviceName = device.getDeviceName(); RenameDeviceDialog.showRenameDeviceDialog(mActivity, previousDeviceName, new RenameDeviceDialogListener() { @Override public void onNewDeviceName(String newDeviceName) { if (!newDeviceName.isEmpty() && !previousDeviceName.equals(newDeviceName)) { mActivity.getDeviceStore().onDeviceRenamed(device, newDeviceName); } } }); break; } return true; } return false; }
From source file:com.easemob.ui.ChatHistoryFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_message) { EMContact tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); // ?//from w w w . j ava 2s. c om EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername()); InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity()); inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername()); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); // ? ((MainActivity) getActivity()).updateUnreadLabel(); return true; } return super.onContextItemSelected(item); }
From source file:org.barbon.mangaget.fragments.MangaList.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.delete: { DeleteConfirmationDialog dlg = DeleteConfirmationDialog.newInstance(info.id, false); bindConfirmationDialog(dlg);// www .ja v a2s . c o m dlg.show(this); return true; } case R.id.delete_all: { DeleteConfirmationDialog dlg = DeleteConfirmationDialog.newInstance(info.id, true); bindConfirmationDialog(dlg); dlg.show(this); return true; } case R.id.refresh: Download.startMangaUpdate(getActivity(), info.id); return true; case R.id.follow: { DB db = DB.getInstance(getActivity()); db.updateMangaSubscription(info.id, DB.SUBSCRIPTION_FOLLOWING); return true; } case R.id.stop_following: { DB db = DB.getInstance(getActivity()); db.updateMangaSubscription(info.id, DB.SUBSCRIPTION_SAVED); return true; } default: return super.onContextItemSelected(item); } }
From source file:cmu.cconfs.instantMessage.activities.ChatHistoryFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_message) { EMContact tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); boolean isGroup = false; if (tobeDeleteUser instanceof EMGroup) isGroup = true;// ww w . j a va2s. c o m // ? EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername(), isGroup); InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity()); inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername()); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); // ? ((IMMainActivity) getActivity()).updateUnreadLabel(); return true; } return super.onContextItemSelected(item); }
From source file:com.givon.anhao.activity.ContactlistFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_contact) { UserBean tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); // ?/*from ww w. j a va 2s . c o m*/ deleteContact(tobeDeleteUser); // ? InviteMessgeDao dao = new InviteMessgeDao(getActivity()); dao.deleteMessage(tobeDeleteUser.getUsername()); return true; } else if (item.getItemId() == R.id.add_to_blacklist) { UserBean user = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); try { //??? EMContactManager.getInstance().addUserToBlackList(user.getUsername(), true); Toast.makeText(getActivity(), "????", 0).show(); } catch (EaseMobException e) { e.printStackTrace(); Toast.makeText(getActivity(), "???", 0).show(); } } return super.onContextItemSelected(item); }
From source file:com.runye.express.chat.activity.ChatHistoryFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_message) { EMContact tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); // ?//from w w w . j a v a 2s. c o m EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername()); InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity()); inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername()); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); // ? ((ChatMainActivity) getActivity()).updateUnreadLabel(); return true; } return super.onContextItemSelected(item); }
From source file:com.wenwen.chatuidemo.activity.ChatHistoryFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getItemId() == R.id.delete_message) { MyUser tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position); boolean isGroup = false; if (tobeDeleteUser instanceof MyUser) isGroup = true;/*from w w w . ja v a2 s . c o m*/ // ? EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getAccount_name(), isGroup); InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity()); inviteMessgeDao.deleteMessage(tobeDeleteUser.getAccount_name()); adapter.remove(tobeDeleteUser); adapter.notifyDataSetChanged(); // ? //((MainActivity) getActivity()).updateUnreadLabel(); return true; } return super.onContextItemSelected(item); }
From source file:com.powermonitor.epitech.CalendarDayFragment.java
@Override public boolean onContextItemSelected(MenuItem item) { if (!getUserVisibleHint()) { return super.onContextItemSelected(item); }// www. j a va2s . c om if (item.getGroupId() == CustomCalendar.CONTEXT_MENU_GROUP) { CustomCalendar.SlotContextMenuInfo info = (CustomCalendar.SlotContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case CustomCalendar.CONTEXT_MENU_ITEM_MODIFY: calendar.updateSlot(info.slot, true); return true; case CustomCalendar.CONTEXT_MENU_ITEM_DELETE: onDeleteOptionSelected(info.slot); return true; } } return super.onContextItemSelected(item); }
From source file:org.lyricue.android.AvailableSongsFragment.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) { if (item.getGroupId() == 2) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); if (adapter != null) { Log.i(TAG, "pos:" + info.position); long itemid = adapter.getItemId(info.position); String itemtext = adapter.getItem(info.position).main; if (item.getItemId() == 0) { Log.i(TAG, "add to playlist:" + itemid + "-" + itemtext); add_to_playlist(itemid); }// ww w . j a v a 2s. c om } return true; } else { return false; } }