本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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, "恢複所有已暫停車次");
}
});
}
示例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;
}
示例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]);
}
}
示例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));
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}