use of android.widget.AdapterView.AdapterContextMenuInfo in project standup-timer by jwood.
the class TeamList method onContextItemSelected.
public boolean onContextItemSelected(MenuItem item) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
switch(item.getItemId()) {
case R.id.delete_team:
positionOfTeamToDelete = info.position;
showDialog(CONFIRM_DELETE_DIALOG);
return true;
default:
return super.onContextItemSelected(item);
}
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project XposedInstaller by rovo89.
the class ModulesFragment method getItemFromContextMenuInfo.
private InstalledModule getItemFromContextMenuInfo(ContextMenuInfo menuInfo) {
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
int position = info.position - getListView().getHeaderViewsCount();
return (position >= 0) ? (InstalledModule) getListAdapter().getItem(position) : null;
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project K6nele by Kaljurand.
the class ServerListActivity method onContextItemSelected.
@Override
public boolean onContextItemSelected(MenuItem item) {
final AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
Cursor cursor = (Cursor) getListView().getItemAtPosition(info.position);
final long key = cursor.getLong(cursor.getColumnIndex(Server.Columns._ID));
String url = cursor.getString(cursor.getColumnIndex(Server.Columns.URL));
switch(item.getItemId()) {
case R.id.cmServerEdit:
Utils.getTextEntryDialog(this, getString(R.string.dialogTitleChangeServer), url, new ExecutableString() {
public void execute(String newUrl) {
try {
updateUrl(CONTENT_URI, key, Server.Columns.URL, newUrl);
} catch (MalformedURLException e) {
toast(getString(R.string.exceptionMalformedUrl));
}
}
}).show();
return true;
case R.id.cmServerDelete:
Utils.getYesNoDialog(this, String.format(getString(R.string.confirmDeleteEntry), url), new Executable() {
public void execute() {
delete(CONTENT_URI, key);
}
}).show();
return true;
default:
return super.onContextItemSelected(item);
}
}
use of android.widget.AdapterView.AdapterContextMenuInfo in project android_frameworks_base by AOSPA.
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 android_frameworks_base by ResurrectionRemix.
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);
}
}
}
Aggregations