Java 类android.widget.AdapterView.AdapterContextMenuInfo 实例源码
项目:q-mail
文件:FolderList.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item .getMenuInfo();
FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);
switch (item.getItemId()) {
case R.id.clear_local_folder:
onClearFolder(mAccount, folder.id);
break;
case R.id.refresh_folder:
checkMail(folder);
break;
case R.id.folder_settings:
FolderSettings.actionSettings(this, mAccount, folder.id);
break;
}
return super.onContextItemSelected(item);
}
项目:CCDownload
文件:UploadFragment.java
@Override
public boolean onContextItemSelected(MenuItem item) {
int selectedPosition = ((AdapterContextMenuInfo) item.getMenuInfo()).position;//获取点击了第几行
UploadInfo uploadInfo = (UploadInfo) uploadAdapter.getItem(selectedPosition);
String uploadId = uploadInfo.getUploadId();
//通知service取消上传
if (!binder.isStop() && uploadId.equals(currentUploadId)) {
binder.cancle();
}
//删除记录
DataSet.removeUploadInfo(uploadId);
initUploadList();
uploadAdapter.notifyDataSetChanged();
uploadListView.invalidate();
return super.onContextItemSelected(item);
}
项目:stynico
文件:HCActivity.java
@Override
public boolean onContextItemSelected(MenuItem item)
{
AdapterContextMenuInfo menuInfo =
(AdapterContextMenuInfo) item.getMenuInfo();
// TODO: Implement this method
if (item.getItemId() == 0)
{
//修改持续时间
showEditTextDialog(HCActivity.this, "设置该图持续的时间(秒)", menuInfo.position);
}
else if (item.getItemId() == 1)
{
//移除项
items.remove(menuInfo.position);
adapter.notifyDataSetChanged();
showToast("移除成功");
}
return super.onOptionsItemSelected(item);
}
项目:stynico
文件:FileList.java
@Override
public boolean onContextItemSelected(MenuItem item)
{
AdapterContextMenuInfo menuInfo =
(AdapterContextMenuInfo) item.getMenuInfo();
// TODO: Implement this method
if (item.getItemId() == 0)
{
//预览
Intent intent = new Intent("android.intent.action.VIEW");
intent.addCategory("android.intent.category.DEFAULT");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.fromFile(new File(curpath + "/" + files_name.get(menuInfo.position - dirs_name.size())));
intent.setDataAndType(uri, "image/*");
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
项目:buildAPKsApps
文件:Export.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo menu_info =
(AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case 0:
export_view_.db_.open(this);
if (export_view_.db_.deleteGraph(export_view_.graph_names_.get(
menu_info.position))) {
export_view_.graph_names_.remove(menu_info.position);
export_view_.adapter_.notifyDataSetChanged();
} else {
Toast.makeText(this, "Failed to delete graph in position " +
Long.toString(menu_info.position) + ".",
Toast.LENGTH_LONG).show();
}
export_view_.db_.close();
return true;
}
return false;
}
项目:aos-Video
文件:AutoScraperActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo);
// Show the name of the file in the header
AdapterContextMenuInfo adapterMenuInfo = (AdapterContextMenuInfo)menuInfo;
int position = adapterMenuInfo.position;
mActivityFileCursor.moveToPosition(position);
String path = mActivityFileCursor.getString(mDataIndex);
MetaFile file = MetaFile.from(path);
menu.setHeaderTitle(file.getName());
// Add the context menu items
menu.add(0, R.string.info, 0, R.string.info);
// Save the path, we will need it when an entry of the menu is selected
mContextMenuPath = path;
}
项目:buildAPKsSamples
文件:AccountsActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
if (v.getId() != R.id.accounts_list) {
return;
}
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
Account account = (Account) adapter.getItem(info.position);
menu.setHeaderTitle(account.toString());
String[] menuItems = getResources().getStringArray(R.array.account_actions);
for (int i = 0; i < menuItems.length; i++) {
menu.add(Menu.NONE, i, i, menuItems[i]);
}
}
项目:encdroidMC
文件:EDVolumeListActivity.java
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.volume_list_context, menu);
// Change the text of the lock/unlock item based on volume status
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
EDVolume selected = mAdapter.getItem((int) info.id);
MenuItem lockItem = menu.findItem(R.id.volume_list_menu_lock);
if (selected.isLocked()) {
lockItem.setTitle(getString(R.string.menu_unlock_volume));
} else {
lockItem.setTitle(getString(R.string.menu_lock_volume));
}
}
项目:encdroidMC
文件:EDVolumeBrowserActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.volume_browser_context, menu);
// if (!this.mEDVolume.getFileProvider().allowRemoteCopy()){
// MenuItem MenuItem =(MenuItem )menu.findItem(R.id.volume_browser_menu_copy);
// MenuItem.setVisible(false);
// }
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo) menuInfo;
int pos = info.position;
EDFileChooserItem selectedFile = mCurFileList.get(pos-1);
MenuItem MenuItem =(MenuItem )menu.findItem(R.id.volume_browser_generage_thumbnail);
if (selectedFile != null && (MimeManagement.isImage(selectedFile.getName()) || MimeManagement.isVideo(selectedFile.getName()))){
MenuItem.setVisible(true);
} else {
MenuItem.setVisible(false);
}
}
项目:prevent
文件:PreventFragment.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
if (!canCreateContextMenu(menu, menuInfo)) {
return;
}
menu.clear();
ViewHolder holder = (ViewHolder) ((AdapterContextMenuInfo) menuInfo).targetView.getTag();
menu.setHeaderTitle(holder.nameView.getText());
if (holder.icon != null) {
setHeaderIcon(menu, holder.icon);
}
menu.add(Menu.NONE, R.string.app_info, Menu.NONE, R.string.app_info);
updatePreventMenu(menu, holder.packageName);
if (getMainIntent(holder.packageName) != null) {
menu.add(Menu.NONE, R.string.open, Menu.NONE, R.string.open);
}
if (holder.canUninstall) {
menu.add(Menu.NONE, R.string.uninstall, Menu.NONE, R.string.uninstall);
}
if (appNotification) {
menu.add(Menu.NONE, R.string.app_notifications, Menu.NONE, R.string.app_notifications);
}
}
项目:TenguChat
文件:ManageAccountActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
ManageAccountActivity.this.getMenuInflater().inflate(
R.menu.manageaccounts_context, menu);
AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
this.selectedAccount = accountList.get(acmi.position);
if (this.selectedAccount.isOptionSet(Account.OPTION_DISABLED)) {
menu.findItem(R.id.mgmt_account_disable).setVisible(false);
menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(false);
menu.findItem(R.id.mgmt_account_publish_avatar).setVisible(false);
menu.findItem(R.id.mgmt_account_change_presence).setVisible(false);
} else {
menu.findItem(R.id.mgmt_account_enable).setVisible(false);
menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(Config.supportOpenPgp());
menu.findItem(R.id.mgmt_account_change_presence).setVisible(manuallyChangePresence());
}
menu.setHeaderTitle(this.selectedAccount.getJid().toBareJid().toString());
}
项目:TAG
文件:ContactlistFragment.java
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getItemId() == R.id.delete_contact) {
User tobeDeleteUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
// 删除此联系人
deleteContact(tobeDeleteUser);
// 删除相关的邀请消息
InviteMessgeDao dao = new InviteMessgeDao(getActivity());
dao.deleteMessage(tobeDeleteUser.getUsername());
return true;
}else if(item.getItemId() == R.id.add_to_blacklist){
User user = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
moveToBlacklist(user.getUsername());
return true;
}
return super.onContextItemSelected(item);
}
项目:TAG
文件:ChatAllHistoryFragment.java
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getItemId() == R.id.delete_message) {
EMConversation tobeDeleteCons = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
// 删除此会话
EMChatManager.getInstance().deleteConversation(tobeDeleteCons.getUserName(),tobeDeleteCons.isGroup());
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteCons.getUserName());
adapter.remove(tobeDeleteCons);
adapter.notifyDataSetChanged();
// 更新消息未读数
((MainActivity) getActivity()).updateUnreadLabel();
return true;
}
return super.onContextItemSelected(item);
}
项目:TAG
文件: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;
// 删除此会话
EMChatManager.getInstance().deleteConversation(tobeDeleteUser.getUsername(),isGroup);
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteUser.getUsername());
adapter.remove(tobeDeleteUser);
adapter.notifyDataSetChanged();
// 更新消息未读数
((MainActivity) getActivity()).updateUnreadLabel();
return true;
}
return super.onContextItemSelected(item);
}
项目:K9-MailClient
文件:FolderList.java
@Override public boolean onContextItemSelected(android.view.MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item .getMenuInfo();
FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);
switch (item.getItemId()) {
case R.id.clear_local_folder:
onClearFolder(mAccount, folder.name);
break;
case R.id.refresh_folder:
checkMail(folder);
break;
case R.id.folder_settings:
FolderSettings.actionSettings(this, mAccount, folder.name);
break;
}
return super.onContextItemSelected(item);
}
项目:LibreTasks
文件:ActivityChooseFiltersAndActions.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
int selectedItemPosition = info.position;
listView.setItemChecked(selectedItemPosition, true); // Set the chosen item as selected
switch (item.getItemId()) {
case MENU_EDIT:
editItem(selectedItemPosition);
return true;
case MENU_DELETE:
confirmDeleteItem(selectedItemPosition);
return true;
default:
return super.onContextItemSelected(item);
}
}
项目:LibreTasks
文件:ActivitySavedRules.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case MENU_EDIT:
editRule(info.position);
return true;
case MENU_DELETE:
deleteRule(info.position);
return true;
case MENU_TOGGLE:
ruleListAdapter.toggleRule(info.position);
return true;
case MENU_NOTIFICATION:
ruleListAdapter.setNotification(info.position);
default:
return super.onContextItemSelected(item);
}
}
项目:ircradio
文件:ActListChannels.java
private void createContextMenu() {
ListView listView = (ListView) this.findViewById(R.id.listChannelsView);
listView
.setOnCreateContextMenuListener(
new View.OnCreateContextMenuListener() {
public void onCreateContextMenu(ContextMenu menu, View view,
ContextMenu.ContextMenuInfo menuInfo) {
AdapterContextMenuInfo mi =
(AdapterContextMenuInfo) menuInfo;
menu.add(0, 0, 0, R.string.ctx_gettopic);
menu.add(0, 1, 0, R.string.ctx_joinchannel);
menu.add(0, 2, 0, R.string.ctx_addchannel);
menu.add(0, 3, 0, R.string.ctx_viewmessages);
}
});
}
项目:messengerxmpp
文件:ManageAccountActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
ManageAccountActivity.this.getMenuInflater().inflate(
R.menu.manageaccounts_context, menu);
AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
this.selectedAccount = accountList.get(acmi.position);
if (this.selectedAccount.isOptionSet(Account.OPTION_DISABLED)) {
menu.findItem(R.id.mgmt_account_disable).setVisible(false);
menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(false);
menu.findItem(R.id.mgmt_account_publish_avatar).setVisible(false);
} else {
menu.findItem(R.id.mgmt_account_enable).setVisible(false);
menu.findItem(R.id.mgmt_account_announce_pgp).setVisible(!Config.HIDE_PGP_IN_UI);
}
menu.setHeaderTitle(this.selectedAccount.getJid().toBareJid().toString());
}
项目:messengerxmpp
文件:StartConversationActivity.java
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v,
final ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
final StartConversationActivity activity = (StartConversationActivity) getActivity();
activity.getMenuInflater().inflate(mResContextMenu, menu);
final AdapterView.AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo;
if (mResContextMenu == R.menu.conference_context) {
activity.conference_context_id = acmi.position;
} else {
activity.contact_context_id = acmi.position;
final Blockable contact = (Contact) activity.contacts.get(acmi.position);
final MenuItem blockUnblockItem = menu.findItem(R.id.context_contact_block_unblock);
XmppConnection xmpp = contact.getAccount().getXmppConnection();
if (xmpp != null && xmpp.getFeatures().blocking()) {
if (contact.isBlocked()) {
blockUnblockItem.setTitle(R.string.unblock_contact);
} else {
blockUnblockItem.setTitle(R.string.block_contact);
}
} else {
blockUnblockItem.setVisible(false);
}
}
}
项目:ST-GIS
文件:FileSelectionActivity.java
@SuppressWarnings("unchecked")
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
.getMenuInfo();
switch (item.getItemId()) {
case R.id.ts_menu_delete:
// TODO file deletion
HashMap<String, String> o = (HashMap<String, String>) getListAdapter()
.getItem(info.position);
String selectedTSFile = (String) o
.get(getString(R.string.FileName));
deleteTSFile(selectedTSFile);
updateList();
return true;
default:
return super.onContextItemSelected(item);
}
}
项目:typhon
文件:ManageSitesActivity.java
@Override
public boolean onContextItemSelected(MenuItem item) {
ContextAction action = ContextAction.values()[item.getItemId()];
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
CustomOPDSSite site = adapter.getItem(info.position);
switch (action) {
case EDIT:
showEditDialog(site);
break;
case DELETE:
adapter.remove(adapter.getItem(info.position));
storeSites();
}
return true;
}
项目:mobile-manager-tool
文件:DragSortListViewFragment.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
if( mFragmentGroupId != 0 ){
menu.add(mFragmentGroupId, PLAY_SELECTION, 0, getResources().getString(R.string.play_all));
menu.add(mFragmentGroupId, ADD_TO_PLAYLIST, 0, getResources().getString(R.string.add_to_playlist));
menu.add(mFragmentGroupId, USE_AS_RINGTONE, 0, getResources().getString(R.string.use_as_ringtone));
menu.add(mFragmentGroupId, REMOVE, 0, R.string.remove);
menu.add(mFragmentGroupId, SEARCH, 0, getResources().getString(R.string.search));
AdapterContextMenuInfo mi = (AdapterContextMenuInfo)menuInfo;
mSelectedPosition = mi.position;
mCursor.moveToPosition(mSelectedPosition);
try {
mSelectedId = mCursor.getLong(mCursor.getColumnIndexOrThrow(mMediaIdColumn));
} catch (IllegalArgumentException ex) {
mSelectedId = mi.id;
}
String title = mCursor.getString(mCursor.getColumnIndexOrThrow(MediaColumns.TITLE));
menu.setHeaderTitle(title);
}
}
项目:OpenUHS
文件:DownloaderActivity.java
@Override
public void onCreateContextMenu( ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo ) {
super.onCreateContextMenu( menu, v, menuInfo );
CatalogItem catItem = catalogAdapter.getItem( ((AdapterContextMenuInfo)menuInfo).position );
if ( catItem != null && catItem.getName().length() > 0 ) {
MenuInflater inflater = getMenuInflater();
inflater.inflate( R.menu.downloader_context_menu, menu );
menu.setHeaderTitle( catItem.getName() );
File uhsFile = new File( hintsDir, catItem.getName() );
if ( uhsFile.exists() ) {
menu.findItem( R.id.openFileContextAction ).setEnabled( true );
menu.findItem( R.id.deleteFileContextAction ).setEnabled( true );
}
}
}
项目:ChatDemoUI3.0
文件:ConversationListFragment.java
@Override
public boolean onContextItemSelected(MenuItem item) {
boolean deleteMessage = false;
if (item.getItemId() == R.id.delete_message) {
deleteMessage = true;
} else if (item.getItemId() == R.id.delete_conversation) {
deleteMessage = false;
}
EMConversation tobeDeleteCons = conversationListView.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
if (tobeDeleteCons == null) {
return true;
}
try {
// delete conversation
EMClient.getInstance().chatManager().deleteConversation(tobeDeleteCons.getUserName(), deleteMessage);
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteCons.getUserName());
} catch (Exception e) {
e.printStackTrace();
}
refresh();
// update unread count
((MainActivity) getActivity()).updateUnreadLabel();
return true;
}
项目:custom-maps
文件:MapEditor.java
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getMenuInfo() instanceof AdapterContextMenuInfo) {
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
TiePoint tiepoint = tiepointAdapter.getItem(menuInfo.position);
switch (item.getItemId()) {
case MENU_ADJUST_TIEPOINT:
launchTiePointActivity(tiepoint);
break;
case MENU_DELETE_TIEPOINT:
tiepointAdapter.remove(tiepoint);
tiepoint.releaseBitmap();
break;
}
return true;
}
return super.onContextItemSelected(item);
}
项目:androboinc
文件:TransfersActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
AdapterContextMenuInfo info = (AdapterContextMenuInfo)menuInfo;
TransferInfo transfer = (TransferInfo)getListAdapter().getItem(info.position);
menu.setHeaderTitle(R.string.taskCtxMenuTitle);
if ((transfer.stateControl & (TransferInfo.ABORTED|TransferInfo.FAILED)) == 0) {
// Not aborted
menu.add(0, ABORT, 0, R.string.transferAbort);
if ((transfer.stateControl & (TransferInfo.RUNNING)) == 0) {
// Not running now
menu.add(0, RETRY, 0, R.string.transferRetry);
}
}
menu.add(0, PROPERTIES, 0, R.string.transferProperties);
}
项目:androboinc
文件:TransfersActivity.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.getMenuInfo();
TransferInfo transfer = (TransferInfo)getListAdapter().getItem(info.position);
switch(item.getItemId()) {
case PROPERTIES:
mPosition = info.position;
showDialog(DIALOG_DETAILS);
return true;
case RETRY:
if (mConnectedClientHandler != null) {
mConnectedClientHandler.transferOperation(this, TransferOp.RETRY, transfer.projectUrl, transfer.fileName);
}
return true;
case ABORT:
mPosition = info.position;
showDialog(DIALOG_WARN_ABORT);
return true;
}
return super.onContextItemSelected(item);
}
项目:androboinc
文件:ProjectsActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
AdapterContextMenuInfo info = (AdapterContextMenuInfo)menuInfo;
ProjectInfo proj = (ProjectInfo)getListAdapter().getItem(info.position);
menu.setHeaderTitle(R.string.projectCtxMenuTitle);
menu.add(0, UPDATE, 0, R.string.projectUpdate);
if ((proj.statusId & ProjectInfo.SUSPENDED) == ProjectInfo.SUSPENDED) {
// project is suspended
menu.add(0, RESUME, 0, R.string.projectResume);
}
else {
// not suspended
menu.add(0, SUSPEND, 0, R.string.projectSuspend);
}
if ((proj.statusId & ProjectInfo.NNW) == ProjectInfo.NNW) {
// No-New-Work is currently set
menu.add(0, ANW, 0, R.string.projectANW);
}
else {
// New work is allowed
menu.add(0, NNW, 0, R.string.projectNNW);
}
menu.add(0, PROPERTIES, 0, R.string.projectProperties);
}
项目:androboinc
文件:TasksActivity.java
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
AdapterContextMenuInfo info = (AdapterContextMenuInfo)menuInfo;
TaskInfo task = (TaskInfo)getListAdapter().getItem(info.position);
menu.setHeaderTitle(R.string.taskCtxMenuTitle);
if (task.stateControl == TaskInfo.SUSPENDED) {
// project is suspended
menu.add(0, RESUME, 0, R.string.taskResume);
}
else {
// not suspended
menu.add(0, SUSPEND, 0, R.string.taskSuspend);
}
if (task.stateControl != TaskInfo.ABORTED) {
// Not aborted
menu.add(0, ABORT, 0, R.string.taskAbort);
}
menu.add(0, PROPERTIES, 0, R.string.taskProperties);
}
项目:androboinc
文件:TasksActivity.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.getMenuInfo();
TaskInfo task = (TaskInfo)getListAdapter().getItem(info.position);
switch(item.getItemId()) {
case PROPERTIES:
mPosition = info.position;
showDialog(DIALOG_DETAILS);
return true;
case SUSPEND:
if (mConnectedClientHandler != null) {
mConnectedClientHandler.taskOperation(this, TaskOp.SUSPEND, task.projectUrl, task.taskName);
}
return true;
case RESUME:
if (mConnectedClientHandler != null) {
mConnectedClientHandler.taskOperation(this, TaskOp.RESUME, task.projectUrl, task.taskName);
}
return true;
case ABORT:
mPosition = info.position;
showDialog(DIALOG_WARN_ABORT);
return true;
}
return super.onContextItemSelected(item);
}
项目:TrueTone
文件:RingdroidSelectActivity.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info =
(AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case CMD_EDIT:
startRingdroidEditor();
return true;
case CMD_DELETE:
confirmDelete();
return true;
case CMD_SET_AS_DEFAULT:
setAsDefaultRingtoneOrNotification();
return true;
case CMD_SET_AS_CONTACT:
return chooseContactForRingtone(item);
default:
return super.onContextItemSelected(item);
}
}
项目:FMTech
文件:cvu.java
public final void onCreateContextMenu(ContextMenu paramContextMenu, View paramView, ContextMenu.ContextMenuInfo paramContextMenuInfo)
{
int j = ((Integer)((AdapterView.AdapterContextMenuInfo)paramContextMenuInfo).targetView.getTag(aau.wM)).intValue();
paramContextMenu.add(0, 1, 0, efj.As).setOnMenuItemClickListener(this);
if (j > 0) {
if (j != 1) {
break label75;
}
}
label75:
for (int k = efj.Aq;; k = efj.Ar)
{
paramContextMenu.add(0, 2, 1, k).setOnMenuItemClickListener(this);
return;
}
}
项目:vibevault
文件:NowPlayingFragment.java
public boolean onContextItemSelected(MenuItem item){
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
if(menuInfo!=null){
switch(item.getItemId()){
case(MENU_REMOVE):
Intent intent = new Intent(PlaybackService.ACTION_DELETE);
intent.putExtra(PlaybackService.EXTRA_PLAYLIST_POSITION, menuInfo.position);
this.getActivity().startService(intent);
break;
default:
return false;
}
return true;
}
return false;
}
项目:DroidShows
文件:SerieSeasons.java
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case ALLEPSEEN_CONTEXT :
db.updateUnwatchedSeason(serieId, seasonNumbers.get(info.position));
getInfo();
return true;
case ALLEPUNSEEN_CONTEXT :
db.updateWatchedSeason(serieId, seasonNumbers.get(info.position));
getInfo();
return true;
case ALLUPTOTHIS_CONTEXT :
for (int i = 1; i <= seasonNumbers.get(info.position); i++) {
db.updateUnwatchedSeason(serieId, i);
}
getInfo();
return true;
default :
return super.onContextItemSelected(item);
}
}
项目:vlc_android_win
文件:AudioPlayer.java
@Override
public boolean onContextItemSelected(MenuItem item) {
if (getUserVisibleHint() && item.getMenuInfo() instanceof AdapterContextMenuInfo) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
if(info == null) // info can be null
return super.onContextItemSelected(item);
int id = item.getItemId();
if(id == R.id.audio_player_mini_remove) {
Log.d(TAG, "Context menu removing " + info.position);
if (mService != null)
mService.remove(info.position);
return true;
}
return super.onContextItemSelected(item);
} else
return false;
}
项目:sdkdemoapp3.0_android
文件:ConversationListFragment.java
@Override
public boolean onContextItemSelected(MenuItem item) {
boolean handled = false;
boolean deleteMessage = false;
/*if (item.getItemId() == R.id.delete_message) {
deleteMessage = true;
handled = true;
} else*/ if (item.getItemId() == R.id.delete_conversation) {
deleteMessage = true;
EMConversation tobeDeleteCons = conversationListView.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
// 删除此会话
EMChatManager.getInstance().deleteConversation(tobeDeleteCons.getUserName(), tobeDeleteCons.isGroup(), deleteMessage);
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteCons.getUserName());
refresh();
// 更新消息未读数
((MainActivity) getActivity()).updateUnreadLabel(); }
return true;
}
项目:Ampdroid
文件:SongsView.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch (item.getItemId()) {
case R.id.contextMenuAdd:
controller.getPlayNow().add(controller.getSongs().get((int) info.id));
Context context = getView().getContext();
CharSequence text = getResources().getString(R.string.songsViewSongAdded);
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
return true;
case R.id.contextMenuSongsOpen:
controller.getPlayNow().clear();
controller.getPlayNow().add(controller.getSongs().get((int) info.id));
((MainActivity) getActivity()).play(0);
return true;
default:
return super.onContextItemSelected(item);
}
}
项目:bible-assistant
文件:BookContentActivity.java
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch(item.getItemId()) {
case R.id.share:
shareSectionContent(info.position);
return true;
case R.id.copy:
copySectionContent(info.position);
return true;
case R.id.add_comments:
startCommentActivity(info.position);
return true;
default:
return super.onContextItemSelected(item);
}
}
项目:EaseChatDemo
文件:ConversationListFragment.java
@Override
public boolean onContextItemSelected(MenuItem item) {
boolean handled = false;
boolean deleteMessage = false;
/*if (item.getItemId() == R.id.delete_message) {
deleteMessage = true;
handled = true;
} else*/
if (item.getItemId() == R.id.delete_conversation) {
EMConversation tobeDeleteCons = conversationListView.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
// 删除此会话
EMChatManager.getInstance().deleteConversation(tobeDeleteCons.getUserName(), tobeDeleteCons.isGroup(), deleteMessage);
InviteMessgeDao inviteMessgeDao = new InviteMessgeDao(getActivity());
inviteMessgeDao.deleteMessage(tobeDeleteCons.getUserName());
refresh();
// 更新消息未读数
((MainActivity) getActivity()).updateUnreadLabel();
}
return true;
}