@Override public boolean onContextItemSelected(final MenuItem item) { final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); switch (item.getItemId()) { case R.id.menu_uninstall: startActivityForResult( new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + model.getPackage(info.id))), (int) (2000 + info.id)); break; case R.id.menu_activate: model.togglePlugin(info.id); adapter.notifyDataSetChanged(); break; case R.id.menu_report: final Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra( Intent.EXTRA_SUBJECT, "Announcify - Problem using " + model.getName(info.id)); sendIntent.putExtra(Intent.EXTRA_TEXT, ""); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"*****@*****.**"}); sendIntent.setType("message/rfc822"); startActivity(sendIntent); break; } return true; }
/** * Called if item in option menu is selected. * * @param item The chosen menu item * @return boolean true/false */ @Override public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) { switch (item.getItemId()) { case R.id.menu_toggle: final boolean activate = !model.getActive(model.getId("Announcify++")); final Cursor cursor = model.getAll(); cursor.moveToFirst(); final int idIndex = cursor.getColumnIndex(BaseColumns._ID); do { model.setActive(cursor.getLong(idIndex), activate); } while (cursor.moveToNext()); cursor.close(); adapter.notifyDataSetChanged(); break; case R.id.menu_rate: startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse( "https://play.google.com/store/apps/details?id=org.mailboxer.saymyname"))); break; case R.id.menu_share: startActivity(ActivityUtils.getShareIntent(this)); break; case R.id.menu_help: startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("https://announcify.uservoice.com/"))); break; case R.id.menu_translate: startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("http://crowdin.net/project/announcify"))); break; case R.id.menu_about: startActivity( new Intent( Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/113909915559103636406"))); break; } return true; }