use of android.widget.AdapterView.AdapterContextMenuInfo in project UltimateAndroid by cymcsg.
the class TeamDetails method onContextItemSelected.
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch(item.getItemId()) {
case R.id.delete_meeting:
positionOfMeetingToDelete = info.position;
showDialog(CONFIRM_DELETE_MEETING_DIALOG);
return true;
default:
return super.onContextItemSelected(item);
}
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project android_frameworks_base by crdroidandroid.
the class SelectPrinterActivity method onCreateContextMenu.
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
if (view == mListView) {
final int position = ((AdapterContextMenuInfo) menuInfo).position;
PrinterInfo printer = (PrinterInfo) mListView.getAdapter().getItem(position);
menu.setHeaderTitle(printer.getName());
// Add the select menu item if applicable.
if (printer.getStatus() != PrinterInfo.STATUS_UNAVAILABLE) {
MenuItem selectItem = menu.add(Menu.NONE, R.string.print_select_printer, Menu.NONE, R.string.print_select_printer);
Intent intent = new Intent();
intent.putExtra(EXTRA_PRINTER, printer);
selectItem.setIntent(intent);
}
// Add the forget menu item if applicable.
if (mPrinterRegistry.isFavoritePrinter(printer.getId())) {
MenuItem forgetItem = menu.add(Menu.NONE, R.string.print_forget_printer, Menu.NONE, R.string.print_forget_printer);
Intent intent = new Intent();
intent.putExtra(EXTRA_PRINTER_ID, printer.getId());
forgetItem.setIntent(intent);
}
}
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project k-9 by k9mail.
the class Accounts method onCreateContextMenu.
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle(R.string.accounts_context_menu_title);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
BaseAccount account = mAdapter.getItem(info.position);
if ((account instanceof Account) && !((Account) account).isEnabled()) {
getMenuInflater().inflate(R.menu.disabled_accounts_context, menu);
} else {
getMenuInflater().inflate(R.menu.accounts_context, menu);
}
if (account instanceof SearchAccount) {
for (int i = 0; i < menu.size(); i++) {
android.view.MenuItem item = menu.getItem(i);
item.setVisible(false);
}
} else {
EnumSet<ACCOUNT_LOCATION> accountLocation = accountLocation(account);
if (accountLocation.contains(ACCOUNT_LOCATION.TOP)) {
menu.findItem(R.id.move_up).setEnabled(false);
} else {
menu.findItem(R.id.move_up).setEnabled(true);
}
if (accountLocation.contains(ACCOUNT_LOCATION.BOTTOM)) {
menu.findItem(R.id.move_down).setEnabled(false);
} else {
menu.findItem(R.id.move_down).setEnabled(true);
}
}
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project k-9 by k9mail.
the class FolderList method onCreateContextMenu.
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
getMenuInflater().inflate(R.menu.folder_context, menu);
FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);
menu.setHeaderTitle(folder.displayName);
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project k-9 by k9mail.
the class FolderList method onContextItemSelected.
@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);
}
Aggregations