@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.ui_connection_menu, menu); super.onCreateOptionsMenu(menu, inflater); MenuItem helpMenu = menu.findItem(R.id.ui_menu_help); helpMenu.setOnMenuItemClickListener(new HelpMenuClickListener()); MenuItem settingMenu = menu.findItem(R.id.ui_menu_setting); settingMenu.setOnMenuItemClickListener(new SettingMenuClickListener()); MenuItem exitMenu = menu.findItem(R.id.ui_menu_exit); exitMenu.setOnMenuItemClickListener(new ExitMenuClickListener()); // refresh button stopButton = (MenuItem) menu.findItem(R.id.ui_menu_stop); if (stopUpdate) stopButton.setIcon(R.drawable.ic_action_start); else stopButton.setIcon(R.drawable.ic_action_stop); stopButton.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { stopUpdate = !stopUpdate; if (stopUpdate) stopButton.setIcon(R.drawable.ic_action_start); else stopButton.setIcon(R.drawable.ic_action_stop); return false; } }); return; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.global, menu); MenuItem menuRestart = menu.findItem(R.id.menuRestart); menuRestart.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { BrandManager.restart(); return false; } }); getSupportActionBar().setDisplayHomeAsUpEnabled(true); menuGuessed = menu.findItem(R.id.menuGuessed); menuScore = menu.findItem(R.id.menuScore); updateScore(); int total = BrandManager.size(); int totalGuessed = BrandManager.sizeGuessed(); menuGuessed.setTitle("Guessed: " + String.valueOf(totalGuessed) + "/" + String.valueOf(total)); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem refresh = menu.add(0, 1, 1, "Joomla"); refresh.setIcon(R.drawable.ic_action_overflow); refresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); refresh.setOnMenuItemClickListener(this); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.actividad_menu, menu); final MenuItem about = menu.findItem(R.id.menu_about); about.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { new BitmapTask().execute(); return false; } }); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.menu_main, menu); mRefreshItem = menu.findItem(R.id.menu_refresh); mRefreshItem.setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { startSync(); item.setActionView(R.layout.indeterminate_progress_action); return true; } }); return super.onCreateOptionsMenu(menu); }
// Options @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER; MenuItem addContactMenu = menu.add(R.string.menu_add_to_contacts); addContactMenu.setIcon(R.drawable.ic_add_contact_holo_dark).setShowAsAction(actionRoom); addContactMenu.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Intent it = ContactsWrapper.getInstance().getAddContactIntent(null, remoteFrom); startActivity(it); return true; } }); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { fav = menu.add("add"); fav.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); fav.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { // TODO Auto-generated method stub MovieSearchFragment searchFrag = new MovieSearchFragment(currentUser); getActivity() .getSupportFragmentManager() .beginTransaction() .replace(R.id.fragmentframe, searchFrag, "movie_search") .addToBackStack(getTag()) .commit(); return true; } }); // fav.sho; // fav.setIcon(R.); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { OsmandApplication app = (OsmandApplication) getActivity().getApplication(); boolean light = app.getSettings().isLightActionBar(); com.actionbarsherlock.view.MenuItem menuItem = menu.add(0, NAVIGATE_TO, 0, R.string.get_directions) .setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menuItem = menuItem.setIcon( light ? R.drawable.ic_action_gdirections_light : R.drawable.ic_action_gdirections_dark); menuItem.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(com.actionbarsherlock.view.MenuItem item) { select(NAVIGATE_TO); return true; } }); TargetPointsHelper targets = app.getTargetPointsHelper(); if (targets.getPointToNavigate() != null) { menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_intermediate_point) .setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menuItem = menuItem.setIcon( light ? R.drawable.ic_action_flage_light : R.drawable.ic_action_flage_dark); } else { menuItem = menu.add(0, ADD_WAYPOINT, 0, R.string.context_menu_item_destination_point) .setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menuItem = menuItem.setIcon( light ? R.drawable.ic_action_flag_light : R.drawable.ic_action_flag_dark); } menuItem.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(com.actionbarsherlock.view.MenuItem item) { select(ADD_WAYPOINT); return true; } }); // } menuItem = menu.add(0, SHOW_ON_MAP, 0, R.string.search_shown_on_map) .setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menuItem = menuItem.setIcon( light ? R.drawable.ic_action_marker_light : R.drawable.ic_action_marker_dark); menuItem.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(com.actionbarsherlock.view.MenuItem item) { select(SHOW_ON_MAP); return true; } }); menuItem = menu.add(0, ADD_TO_FAVORITE, 0, R.string.add_to_favourite) .setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menuItem = menuItem.setIcon(light ? R.drawable.ic_action_fav_light : R.drawable.ic_action_fav_dark); menuItem.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(com.actionbarsherlock.view.MenuItem item) { select(ADD_TO_FAVORITE); return true; } }); }