Java Code Examples for android.widget.AdapterView.AdapterContextMenuInfo

The following are top voted examples for showing how to use android.widget.AdapterView.AdapterContextMenuInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: q-mail   File: FolderList.java   View source code 6 votes vote down vote up
@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);
}
 
Example 2
Project: CCDownload   File: UploadFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 3
Project: stynico   File: HCActivity.java   View source code 6 votes vote down vote up
@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);
   }
 
Example 4
Project: stynico   File: FileList.java   View source code 6 votes vote down vote up
@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);
   }
 
Example 5
Project: buildAPKsApps   File: Export.java   View source code 6 votes vote down vote up
@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; 
}
 
Example 6
Project: Huochexing12306   File: MonitorMangAty.java   View source code 6 votes vote down vote up
private void setListViewContextMenuWithDel_Resume() {
	lvMang.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
		
		@Override
		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo) {
			intCurrDataPos = ((AdapterContextMenuInfo) menuInfo).position;
			menu.add(0, 0, 0, "删除");
			menu.add(0, 1, 1, "恢复所有已暂停车次");
		}
	});
}
 
Example 7
Project: aos-Video   File: AutoScraperActivity.java   View source code 6 votes vote down vote up
@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;
}
 
Example 8
Project: buildAPKsSamples   File: AccountsActivity.java   View source code 6 votes vote down vote up
@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]);
  }
}
 
Example 9
Project: encdroidMC   File: EDVolumeListActivity.java   View source code 6 votes vote down vote up
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));
	}
}
 
Example 10
Project: encdroidMC   File: EDVolumeBrowserActivity.java   View source code 6 votes vote down vote up
@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);
		  }
		
	}
 
Example 11
Project: prevent   File: PreventFragment.java   View source code 6 votes vote down vote up
@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);
    }
}
 
Example 12
Project: TenguChat   File: ManageAccountActivity.java   View source code 6 votes vote down vote up
@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());
}
 
Example 13
Project: TAG   File: ContactlistFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 14
Project: TAG   File: ChatAllHistoryFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 15
Project: TAG   File: ChatHistoryFragment.java   View source code 6 votes vote down vote up
@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);
}
 
Example 16
Project: K9-MailClient   File: FolderList.java   View source code 6 votes vote down vote up
@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);
}
 
Example 17
Project: LibreTasks   File: ActivityChooseFiltersAndActions.java   View source code 6 votes vote down vote up
@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);
  }
}
 
Example 18
Project: LibreTasks   File: ActivitySavedRules.java   View source code 6 votes vote down vote up
@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);
  }
}
 
Example 19
Project: ircradio   File: ActListChannels.java   View source code 6 votes vote down vote up
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);
                            }
                        });
    }
 
Example 20
Project: messengerxmpp   File: ManageAccountActivity.java   View source code 6 votes vote down vote up
@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());
}
 
Example 21
Project: messengerxmpp   File: StartConversationActivity.java   View source code 6 votes vote down vote up
@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);
		}
	}
}
 
Example 22
Project: ST-GIS   File: FileSelectionActivity.java   View source code 6 votes vote down vote up
@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);
	}
}
 
Example 23
Project: typhon   File: ManageSitesActivity.java   View source code 6 votes vote down vote up
@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;
}
 
Example 24
Project: mobile-manager-tool   File: DragSortListViewFragment.java   View source code 6 votes vote down vote up
@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);
    }
}
 
Example 25
Project: OpenUHS   File: DownloaderActivity.java   View source code 6 votes vote down vote up
@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 );
		}
	}
}
 
Example 26
Project: ChatDemoUI3.0   File: ConversationListFragment.java   View source code 6 votes vote down vote up
@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;
}
 
Example 27
Project: custom-maps   File: MapEditor.java   View source code 6 votes vote down vote up
@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);
}
 
Example 28
Project: androboinc   File: TransfersActivity.java   View source code 6 votes vote down vote up
@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);
}
 
Example 29
Project: androboinc   File: TransfersActivity.java   View source code 6 votes vote down vote up
@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);
}
 
Example 30
Project: androboinc   File: ProjectsActivity.java   View source code 6 votes vote down vote up
@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);
}
 
Example 31
Project: androboinc   File: TasksActivity.java   View source code 6 votes vote down vote up
@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);
}
 
Example 32
Project: androboinc   File: TasksActivity.java   View source code 6 votes vote down vote up
@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);
}
 
Example 33
Project: TrueTone   File: RingdroidSelectActivity.java   View source code 6 votes vote down vote up
@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);
    }
}
 
Example 34
Project: FMTech   File: cvu.java   View source code 6 votes vote down vote up
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;
  }
}
 
Example 35
Project: vibevault   File: NowPlayingFragment.java   View source code 6 votes vote down vote up
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;
}
 
Example 36
Project: DroidShows   File: SerieSeasons.java   View source code 6 votes vote down vote up
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);
	}
}
 
Example 37
Project: vlc_android_win   File: AudioPlayer.java   View source code 6 votes vote down vote up
@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;
}
 
Example 38
Project: sdkdemoapp3.0_android   File: ConversationListFragment.java   View source code 6 votes vote down vote up
@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;
}
 
Example 39
Project: Ampdroid   File: SongsView.java   View source code 6 votes vote down vote up
@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);
	}
}
 
Example 40
Project: bible-assistant   File: BookContentActivity.java   View source code 6 votes vote down vote up
@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);
    }
}