@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 onPrepareOptionsMenu(Menu menu) { if (isMakingSearch) { menu.findItem(App.MENU_SEARCH_SEARCH_BOOKS).setVisible(false); } else { menu.findItem(App.MENU_SEARCH_SEARCH_BOOKS).setVisible(true); } // If library is selected, show register option if (isItemChecked) { if (app.selectedBook.status != App.BOOK_STATE_USER_DONT_OWNS) { menu.findItem(App.MENU_MY_BOOKS_BOOK_SELECTED) .setVisible(true) .setTitle(getString(R.string.edit) + ": " + app.selectedBook.title); } else { menu.findItem(App.MENU_MY_BOOKS_BOOK_SELECTED) .setVisible(true) .setTitle(getString(R.string.view) + ": " + app.selectedBook.title); } } else { menu.findItem(App.MENU_MY_BOOKS_BOOK_SELECTED).setVisible(false); } return true; }
private void setPrevNextButtonState(PageModel pageModel) { if (_menu != null) { boolean isNextEnabled = false; boolean isPrevEnabled = false; try { PageModel prevPage = novelDetails.getPrev( pageModel.getPage(), UIHelper.getShowMissing(this), UIHelper.getShowRedlink(this)); if (prevPage != null) isPrevEnabled = true; } catch (Exception ex) { Log.e(TAG, "Failed to get prev chapter: " + pageModel.getPage(), ex); } try { PageModel nextPage = novelDetails.getNext( pageModel.getPage(), UIHelper.getShowMissing(this), UIHelper.getShowRedlink(this)); if (nextPage != null) isNextEnabled = true; } catch (Exception ex) { Log.e(TAG, "Failed to get next chapter: " + pageModel.getPage(), ex); } _menu.findItem(R.id.menu_chapter_next).setEnabled(isNextEnabled); _menu.findItem(R.id.menu_chapter_previous).setEnabled(isPrevEnabled); } }
@Override protected boolean prepareActionMode(ActionMode mode, Menu menu, QuranRow[] selected) { MenuItem editItem = menu.findItem(R.id.cab_edit_tag); MenuItem removeItem = menu.findItem(R.id.cab_delete_tag); MenuItem tagItem = menu.findItem(R.id.cab_tag_bookmark); int headers = 0; int bookmarks = 0; for (QuranRow row : selected) { if (row.isBookmarkHeader()) { headers++; } else if (row.isBookmark()) { bookmarks++; } } boolean canEdit = headers == 1 && bookmarks == 0; boolean canRemove = (headers + bookmarks) > 0; boolean canTag = headers == 0 && bookmarks > 0; editItem.setVisible(canEdit); removeItem.setVisible(canRemove); tagItem.setVisible(canTag); return true; }
@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 void onPrepareOptionsMenu(Menu menu) { MenuItem menuProgress = menu.findItem(R.id.menu_progress); MenuItem menuRefresh = menu.findItem(R.id.menu_refresh); menuProgress.setVisible(mProgressIndicator); menuRefresh.setVisible(!mProgressIndicator); }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.main, menu); getSupportActionBar().setDisplayShowHomeEnabled(true); // ActionBar Layout Backgroung color changing GREEN == Ramesh Gundala com.actionbarsherlock.app.ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar)); ImageButton b = new ImageButton(getApplicationContext()); b.setBackgroundDrawable(null); b.setImageDrawable(getResources().getDrawable(R.drawable.buttondone)); b.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(getApplicationContext(), MortgageNegotiatorActivity_.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }); menu.findItem(R.id.btnDone).setActionView(b); menu.findItem(R.id.github).setVisible(false); menu.findItem(R.id.btnDone).setVisible(true); return true; }
@TargetApi(Build.VERSION_CODES.FROYO) @Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.activity_channel, menu); searchItem = menu.findItem(R.id.menu_search); if (mViewPager == null) fullscreenButton = menu.findItem(R.id.menu_fullscreen); if (VERSION.SDK_INT >= 8) { // SearchManager supported by Froyo+. SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } else { searchItem.setVisible(false); } mutedButton = menu.findItem(R.id.menu_mute_button); deafenedButton = menu.findItem(R.id.menu_deafen_button); if (mService != null && mService.getCurrentUser() != null) { updateMuteDeafenMenuItems(mService.isMuted(), mService.isDeafened()); } return true; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.activity_main, menu); _menuReload = (MenuItem) menu.findItem(R.id.menu_reload); _menuReloading = (MenuItem) menu.findItem(R.id.menu_reloading); }
@Override public void onPrepareOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view boolean isDrawerOpen = ((BaseNavDrawerActivity) getActivity()).isDrawerOpen(); menu.findItem(R.id.menu_manage_lists).setVisible(!isDrawerOpen); menu.findItem(R.id.menu_share).setVisible(!isDrawerOpen); super.onPrepareOptionsMenu(menu); }
/** * Set the title of the "Toggle Unread" menu item based upon the current read state of the * message. */ public void updateUnreadToggleTitle() { if (mMessage != null && mMenu != null) { if (mMessage.isSet(Flag.SEEN)) { mMenu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_unread_action); } else { mMenu.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_read_action); } } }
@Override public boolean onPrepareOptionsMenu(Menu menu) { ActionBar actionBar = getSupportActionBar(); if (actionBar.getSelectedNavigationIndex() == 0) { menu.findItem(R.id.menu_new).setVisible(false); } else { menu.findItem(R.id.menu_new).setVisible(true); } return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.activity_main, menu); // android.util.Log.d("CHAN", ""+menu.findItem(R.id.menu_reply)); // android.util.Log.d("CHAN", ""+getHomeFragment()); menu.findItem(R.id.menu_reply).setEnabled(!getHomeFragment().isBoardsPage()); menu.findItem(R.id.menu_refresh).setEnabled(!getHomeFragment().isBoardsPage()); menu.findItem(R.id.menu_close).setEnabled(!getHomeFragment().isBoardsPage()); return true; }
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (currentFragment != null) { handleShowDetails(currentFragment.getShowDetails(), menu.findItem(R.id.show_details)); menu.findItem(R.id.unpacking).setVisible(false); menu.findItem(R.id.backpack).setVisible(false); menu.findItem(R.id.cut).setVisible(false); menu.findItem(R.id.rename).setVisible(false); } return super.onPrepareOptionsMenu(menu); }
@Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { // When the given tab is selected, show the tab contents in the container int layout = R.layout.fragment_add_clips; if (mMenu != null) { mMenu.findItem(R.id.itemInfo).setVisible(false); mMenu.findItem(R.id.itemTrim).setVisible(false); } if (tab.getPosition() == 0) { if (mMenu != null) { mMenu.findItem(R.id.itemForward).setEnabled(true); } layout = R.layout.fragment_add_clips; } else if (tab.getPosition() == 1) { layout = R.layout.fragment_order_clips; if (mMenu != null) { mMenu.findItem(R.id.itemInfo).setVisible(true); mMenu.findItem(R.id.itemTrim).setVisible(true); mMenu.findItem(R.id.itemForward).setEnabled(true); } } else if (tab.getPosition() == 2) { layout = R.layout.fragment_story_publish; mMenu.findItem(R.id.itemForward).setEnabled(false); } String tag = "" + layout; FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentByTag(tag + ""); if (fragment == null) { try { fragment = new SceneChooserFragment(layout, fm, templateJsonPath); Bundle args = new Bundle(); args.putInt(SceneChooserFragment.ARG_SECTION_NUMBER, tab.getPosition() + 1); fragment.setArguments(args); } catch (IOException e) { Log.e("SceneEditr", "IO erorr", e); } catch (JSONException e) { Log.e("SceneEditr", "json error", e); } } fm.beginTransaction() .replace(R.id.container, fragment, tag) // .addToBackStack(null) .commit(); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.shows_menu, menu); // set filter check box states menu.findItem(R.id.menu_action_shows_filter_favorites).setChecked(mIsFilterFavorites); menu.findItem(R.id.menu_action_shows_filter_unwatched).setChecked(mIsFilterUnwatched); menu.findItem(R.id.menu_action_shows_filter_upcoming).setChecked(mIsFilterUpcoming); menu.findItem(R.id.menu_action_shows_filter_hidden).setChecked(mIsFilterHidden); // set sort check box state menu.findItem(R.id.menu_action_shows_sort_favorites).setChecked(mIsSortFavoritesFirst); }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate your menu. getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. actionProvider.setShareIntent(createShareIntent()); // XXX: For now, ShareActionProviders must be displayed on the action bar // Set file with share history to the provider and set the share intent. // MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow); // ShareActionProvider overflowProvider = // (ShareActionProvider) overflowItem.getActionProvider(); // overflowProvider.setShareHistoryFileName( // ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. // overflowProvider.setShareIntent(createShareIntent()); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.message_list_option, menu); mMenu = menu; mMenuButtonCheckMail = menu.findItem(R.id.check_mail); return true; }
@Override @SuppressLint("NewApi") public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.activity_display_light_novel_content, menu); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { if (getFullscreenPreferences()) { menu.findItem(R.id.menu_chapter_next).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.findItem(R.id.menu_chapter_previous).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } } tts.setupTTSMenu(menu); _menu = menu; return true; }
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (currentFragment != null) { handleShowDetails(currentFragment.getShowDetails(), menu.findItem(R.id.show_details)); } return super.onPrepareOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.notification_list_menu, menu); menubarSyncButton = menu.findItem(R.id.menu_load); super.onCreateOptionsMenu(menu); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.main, menu); if (mDisableMusic) { menu.findItem(R.id.disableMusic).setVisible(false); } return true; }
@Override public void onPrepareOptionsMenu(Menu menu) { if (classList == null || classList.size() == 0) { menu.findItem(R.id.map_all_classes).setEnabled(false); MenuItem exportSchedule; // <4.0 can't export schedule, so MenuItem will be null if ((exportSchedule = menu.findItem(R.id.export_schedule)) != null) { exportSchedule.setEnabled(false); } } else { menu.findItem(R.id.map_all_classes).setEnabled(true); MenuItem exportSchedule; if ((exportSchedule = menu.findItem(R.id.export_schedule)) != null) { exportSchedule.setEnabled(true); } } }
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.lte_coverage_menu, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return true; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.tropes_fragment_menu, menu); inflater.inflate(R.menu.index_fragment_menu, menu); MenuItem shareItem = menu.findItem(R.id.share_article); shareProvider = (ShareActionProvider) shareItem.getActionProvider(); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { // Only show favourites and access tokens (DB-related) if the connected server has a DB // representation (non-public). MenuItem fullscreenItem = menu.findItem(R.id.menu_fullscreen); MenuItem favouritesViewItem = menu.findItem(R.id.menu_view_favorites_button); MenuItem accessTokensItem = menu.findItem(R.id.menu_access_tokens_button); userRegisterItem = menu.findItem(R.id.menu_user_register); userCommentItem = menu.findItem(R.id.menu_user_comment); userInformationItem = menu.findItem(R.id.menu_user_information); if (mService != null && mService.getConnectedServer() != null) { favouritesViewItem.setVisible(!mService.isConnectedServerPublic()); accessTokensItem.setVisible(!mService.isConnectedServerPublic()); } fullscreenItem.setVisible(mViewPager == null); // Only show fullscreen option if in tablet mode // Show whether or not SCO is enabled AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE); bluetoothItem = menu.findItem(R.id.menu_bluetooth); bluetoothItem.setChecked(audioManager.isBluetoothScoOn()); return super.onPrepareOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.outline_menu, menu); synchronizerMenuItem = menu.findItem(R.id.menu_sync); return true; }
/** * Update the contextual action bar for the number of item selected * * @param numSelected */ private void updateCAB(int numSelected) { if (actionMode == null) return; Menu menu = actionMode.getMenu(); if (numSelected == 1) { if (selected.get(0).canEdit()) { menu.findItem(R.id.edit).setVisible(true); } else { menu.findItem(R.id.edit).setVisible(false); } } else { menu.findItem(R.id.edit).setVisible(false); } String title = getResources() .getQuantityString(R.plurals.quantity_sources_selected, numSelected, numSelected); actionMode.setTitle(title); }
@Override public boolean onCreateOptionsMenu(Menu menu) { this.getSupportMenuInflater().inflate(R.menu.country, menu); menu.findItem(R.id.memory_cache).setChecked(this.webImageManager.isMemoryCacheEnabled()); menu.findItem(R.id.file_cache).setChecked(this.webImageManager.isFileCacheEnabled()); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, this.getString(R.string.share_subject)); shareIntent.putExtra( Intent.EXTRA_TEXT, this.getString(R.string.share_text, this.getString(R.string.website_url))); ((ShareActionProvider) menu.findItem(R.id.share).getActionProvider()) .setShareIntent(shareIntent); return super.onCreateOptionsMenu(menu); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { // If the nav drawer is open, hide action items related to the content // view boolean isDrawerOpen = isDrawerOpen(); menu.findItem(R.id.menu_list_add).setVisible(!isDrawerOpen); return super.onPrepareOptionsMenu(menu); }