当前位置: 首页>>代码示例>>Java>>正文


Java AdapterContextMenuInfo类代码示例

本文整理汇总了Java中android.widget.AdapterView.AdapterContextMenuInfo的典型用法代码示例。如果您正苦于以下问题:Java AdapterContextMenuInfo类的具体用法?Java AdapterContextMenuInfo怎么用?Java AdapterContextMenuInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AdapterContextMenuInfo类属于android.widget.AdapterView包,在下文中一共展示了AdapterContextMenuInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:19,代码来源:FolderList.java

示例2: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:21,代码来源:UploadFragment.java

示例3: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:21,代码来源:HCActivity.java

示例4: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:20,代码来源:FileList.java

示例5: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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; 
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:23,代码来源:Export.java

示例6: setListViewContextMenuWithDel_Resume

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
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, "恢复所有已暂停车次");
		}
	});
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:13,代码来源:MonitorMangAty.java

示例7: onCreateContextMenu

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:19,代码来源:AutoScraperActivity.java

示例8: onCreateContextMenu

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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]);
  }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:17,代码来源:AccountsActivity.java

示例9: onCreateContextMenu

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
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));
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:20,代码来源:EDVolumeListActivity.java

示例10: onCreateContextMenu

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
		  }
		
	}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:26,代码来源:EDVolumeBrowserActivity.java

示例11: onCreateContextMenu

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:brevent,项目名称:prevent,代码行数:24,代码来源:PreventFragment.java

示例12: onCreateContextMenu

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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());
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:20,代码来源:ManageAccountActivity.java

示例13: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:18,代码来源:ContactlistFragment.java

示例14: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:19,代码来源:ChatAllHistoryFragment.java

示例15: onContextItemSelected

import android.widget.AdapterView.AdapterContextMenuInfo; //导入依赖的package包/类
@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);
}
 
开发者ID:macyuan,项目名称:TAG,代码行数:22,代码来源:ChatHistoryFragment.java


注:本文中的android.widget.AdapterView.AdapterContextMenuInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。