List of usage examples for android.view MenuItem SHOW_AS_ACTION_NEVER
int SHOW_AS_ACTION_NEVER
To view the source code for android.view MenuItem SHOW_AS_ACTION_NEVER.
Click Source Link
From source file:org.path.episample.android.activities.MainMenuActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); int showOption = MenuItem.SHOW_AS_ACTION_IF_ROOM; MenuItem item;//from w w w .j ava 2s . c o m if (currentFragment != ScreenList.WEBKIT) { ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); actionBar.show(); item = menu.add(Menu.NONE, MENU_MAIN_MENU, Menu.NONE, getString(R.string.main_menu)); item.setIcon(R.drawable.ic_action_home).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); //item = menu.add(Menu.NONE, MENU_FILL_FORM, Menu.NONE, getString(R.string.enter_data_button)); //item.setIcon(R.drawable.ic_action_collections_collection).setShowAsAction(showOption); // Using a file for this work now String get = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_GET_BLANK); if (get.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_PULL_FORMS, Menu.NONE, getString(R.string.get_forms)); item.setIcon(R.drawable.ic_action_av_download).setShowAsAction(showOption); //item = menu.add(Menu.NONE, MENU_CLOUD_FORMS, Menu.NONE, getString(R.string.get_forms)); //item.setIcon(R.drawable.ic_action_cloud).setShowAsAction(showOption); } String send = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_FINALIZED); if (send.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_PUSH_FORMS, Menu.NONE, getString(R.string.send_data)); item.setIcon(R.drawable.ic_action_av_upload).setShowAsAction(showOption); } String manage = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_MANAGE_FORMS); if (manage.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_MANAGE_FORMS, Menu.NONE, getString(R.string.manage_files)); item.setIcon(R.drawable.trash).setShowAsAction(showOption); } String settings = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_ACCESS_SETTINGS); if (settings.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_PREFERENCES, Menu.NONE, getString(R.string.general_preferences)); item.setIcon(R.drawable.ic_menu_preferences).setShowAsAction(showOption); } item = menu.add(Menu.NONE, MENU_ADMIN_PREFERENCES, Menu.NONE, getString(R.string.admin_preferences)); item.setIcon(R.drawable.ic_action_device_access_accounts).setShowAsAction(showOption); String backup = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_BACKUP_CENSUS); if (backup != null && backup.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_BACKUP_CENSUS, Menu.NONE, getString(R.string.backup_census)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } String restore = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_RESTORE_CENSUS); if (restore != null && restore.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_RESTORE_CENSUS, Menu.NONE, getString(R.string.restore_census)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } String invalidateCensus = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_INVALIDATE_CENSUS); if (invalidateCensus != null && invalidateCensus.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_MARK_CENSUS_AS_INVALID, Menu.NONE, getString(R.string.invalidate_census)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } String edit = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_EDIT_CENSUS); if (edit != null && edit.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_EDIT_CENSUS, Menu.NONE, getString(R.string.edit_census)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } String removeCensus = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_REMOVE_CENSUS); if (removeCensus != null && removeCensus.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_REMOVE_CENSUS, Menu.NONE, getString(R.string.remove_census)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } /*String send_receive_bt = PropertiesSingleton.getProperty(appName, AdminPreferencesActivity.KEY_SEND_RECEIVE_BLUETOOTH); if (send_receive_bt != null && send_receive_bt.equalsIgnoreCase("true")) { item = menu.add(Menu.NONE, MENU_SEND_REVEIVE_BLUETOOTH, Menu.NONE, getString(R.string.send_receive_bluetooth)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); }*/ item = menu.add(Menu.NONE, MENU_ABOUT, Menu.NONE, getString(R.string.about)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } else { ActionBar actionBar = getActionBar(); actionBar.hide(); } return true; }
From source file:org.alfresco.mobile.android.application.fragments.node.details.NodeDetailsFragment.java
public void getMenu(Context context, AlfrescoSession session, Menu menu, Node node) { MenuItem mi;/* w w w .j a v a2 s.c o m*/ if (node == null) { return; } if (node instanceof NodeSyncPlaceHolder) { return; } boolean isRestrict = node.hasAspect(ContentModel.ASPECT_RESTRICTABLE); if (node.isDocument()) { if (((Document) node).getContentStreamLength() > 0 && !isRestrict && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_DOWNLOAD)) { mi = menu.add(Menu.NONE, R.id.menu_action_download, Menu.FIRST, R.string.download); mi.setIcon(R.drawable.ic_download_light); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (((Document) node).isLatestVersion() && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_UPDATE)) { mi = menu.add(Menu.NONE, R.id.menu_action_update, Menu.FIRST + 130, R.string.update); mi.setIcon(R.drawable.ic_upload); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (!(session instanceof CloudSession) && ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_REVIEW)) { mi = menu.add(Menu.NONE, R.id.menu_workflow_add, Menu.FIRST + 500, R.string.process_start_review); mi.setIcon(R.drawable.ic_start_review); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } } if (session == null) { return; } if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_EDIT)) { mi = menu.add(Menu.NONE, R.id.menu_action_edit, Menu.FIRST + 10, R.string.edit); mi.setIcon(R.drawable.ic_properties); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (node.hasAspect(ContentModel.ASPECT_GEOGRAPHIC)) { mi = menu.add(Menu.NONE, R.id.menu_action_location, Menu.FIRST + 50, R.string.geolocation); mi.setIcon(R.drawable.ic_location); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } if (ConfigurableActionHelper.isVisible(getActivity(), getAccount(), getSession(), node, ConfigurableActionHelper.ACTION_NODE_DELETE)) { mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete); mi.setIcon(R.drawable.ic_delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } }
From source file:org.kiwix.kiwixmobile.KiwixMobileActivity.java
void toggleActionItemsConfig() { if (menu != null) { MenuItem random = menu.findItem(R.id.menu_randomarticle); MenuItem home = menu.findItem(R.id.menu_home); if (getResources().getConfiguration().orientation == ORIENTATION_LANDSCAPE) { random.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); home.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } else {// w w w . j a va 2 s. co m random.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); home.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } } }
From source file:org.uguess.android.sysinfo.SiragonManager.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem mi = menu.add(Menu.NONE, MI_REFRESH, Menu.NONE, R.string.refresh); mi.setIcon(android.R.drawable.ic_menu_rotate); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_IF_ROOM); /*mi = menu.add( Menu.NONE, MI_ABOUT, Menu.NONE, R.string.about ); mi.setIcon( android.R.drawable.ic_menu_info_details ); Util.setShowAsAction( mi, MenuItem.SHOW_AS_ACTION_NEVER ); /*from ww w .j av a 2 s . co m*/ mi = menu.add( Menu.NONE, MI_HELP, Menu.NONE, R.string.help ); mi.setIcon( android.R.drawable.ic_menu_help ); Util.setShowAsAction( mi, MenuItem.SHOW_AS_ACTION_NEVER );*/ mi = menu.add(Menu.NONE, MI_PREFERENCE, Menu.NONE, R.string.preference); mi.setIcon(android.R.drawable.ic_menu_preferences); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER); mi = menu.add(Menu.NONE, MI_EXIT, Menu.NONE, R.string.exit); mi.setIcon(android.R.drawable.ic_menu_close_clear_cancel); Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER); }
From source file:com.android.gallery3d.app.PhotoPage.java
private void updatePanoramaUI(boolean isPanorama360) { Menu menu = mActionBar.getMenu(); // it could be null if onCreateActionBar has not been called yet if (menu == null) { return;/*from w w w . j a va 2s . c om*/ } MenuExecutor.updateMenuForPanorama(menu, isPanorama360, isPanorama360); if (isPanorama360) { MenuItem item = menu.findItem(R.id.action_share); if (item != null) { item.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); item.setTitle(mActivity.getResources().getString(R.string.share_as_photo)); } } else if ((mCurrentPhoto.getSupportedOperations() & MediaObject.SUPPORT_SHARE) != 0) { MenuItem item = menu.findItem(R.id.action_share); if (item != null) { item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); item.setTitle(mActivity.getResources().getString(R.string.share)); } } }
From source file:com.android.mms.ui.ComposeMessageActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); menu.clear();//w ww . j a v a 2 s . c o m if (mSendDiscreetMode && !mForwardMessageMode) { // When we're in send-a-single-message mode from the lock screen, don't show // any menus. return true; } if (isRecipientCallable()) { MenuItem item = menu.add(0, MENU_CALL_RECIPIENT, 0, R.string.menu_call) .setIcon(R.drawable.ic_menu_call_holo_light).setTitle(R.string.menu_call); if (!isRecipientsEditorVisible()) { // If we're not composing a new message, show the call icon in the actionbar item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } } if (MmsConfig.getMmsEnabled() && mIsSmsEnabled) { if (!isSubjectEditorVisible()) { menu.add(0, MENU_ADD_SUBJECT, 0, R.string.add_subject).setIcon(R.drawable.ic_menu_edit); } if (!mWorkingMessage.hasAttachment()) { menu.add(0, MENU_ADD_ATTACHMENT, 0, R.string.add_attachment) .setIcon(R.drawable.ic_menu_attachment_holo_light).setTitle(R.string.add_attachment) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); // add to actionbar } } menu.add(0, MENU_ADD_TEMPLATE, 0, R.string.template_insert).setIcon(android.R.drawable.ic_menu_add) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); if (isPreparedForSending() && mIsSmsEnabled) { menu.add(0, MENU_SEND, 0, R.string.send).setIcon(android.R.drawable.ic_menu_send); } if (!mWorkingMessage.hasSlideshow() && mIsSmsEnabled && mEnableEmoticons) { menu.add(0, MENU_INSERT_SMILEY, 0, R.string.menu_insert_smiley).setIcon(R.drawable.ic_menu_emoticons); } if (getRecipients().size() > 1) { menu.add(0, MENU_GROUP_PARTICIPANTS, 0, R.string.menu_group_participants); } if (mMsgListAdapter.getCount() > 0 && mIsSmsEnabled) { // Removed search as part of b/1205708 //menu.add(0, MENU_SEARCH, 0, R.string.menu_search).setIcon( // R.drawable.ic_menu_search); Cursor cursor = mMsgListAdapter.getCursor(); if ((null != cursor) && (cursor.getCount() > 0)) { menu.add(0, MENU_DELETE_THREAD, 0, R.string.delete_thread) .setIcon(android.R.drawable.ic_menu_delete); } } else if (mIsSmsEnabled) { menu.add(0, MENU_DISCARD, 0, R.string.discard).setIcon(android.R.drawable.ic_menu_delete); } buildAddAddressToContactMenuItem(menu); // Add to Blacklist item (if enabled) and we are running on CyanogenMod // This allows the app to be run on non-blacklist enabled roms (including Stock) if (MessageUtils.isCyanogenMod(this)) { if (BlacklistUtils.isBlacklistEnabled(this)) { menu.add(0, MENU_ADD_TO_BLACKLIST, 0, R.string.add_to_blacklist) .setIcon(R.drawable.ic_block_message_holo_dark) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } } if (mConversation.getThreadId() > 0) { menu.add(0, MENU_CONVERSATION_OPTIONS, 0, R.string.menu_conversation_options); } menu.add(0, MENU_PREFERENCES, 0, R.string.menu_preferences).setIcon(android.R.drawable.ic_menu_preferences); if (LogTag.DEBUG_DUMP) { menu.add(0, MENU_DEBUG_DUMP, 0, R.string.menu_debug_dump); } return true; }
From source file:org.tvbrowser.tvbrowser.TvBrowser.java
private void updateFromPreferences(boolean finish) { SettingConstants.initializeLogoMap(getApplicationContext(), true); Fragment test1 = mSectionsPagerAdapter.getRegisteredFragment(1); if (test1 instanceof FragmentProgramsList) { ((FragmentProgramsList) test1).updateChannels(); }/*from w ww . ja va2 s. c o m*/ Fragment fragment = mSectionsPagerAdapter.getRegisteredFragment(2); if (fragment instanceof FragmentFavorites) { ((FragmentFavorites) fragment).updateSynchroButton(null); ((FragmentFavorites) fragment).updateProgramsList(); } boolean programTableActivated = PrefUtils.getBooleanValue(R.string.PROG_TABLE_ACTIVATED, R.bool.prog_table_activated_default); Fragment test = mSectionsPagerAdapter.getRegisteredFragment(3); if (!programTableActivated && test instanceof ProgramTableFragment) { ((ProgramTableFragment) test).removed(); mSectionsPagerAdapter.destroyItem(mViewPager, 3, mSectionsPagerAdapter.getRegisteredFragment(3)); mSectionsPagerAdapter.notifyDataSetChanged(); actionBar.removeTabAt(3); } else if (!(test instanceof ProgramTableFragment) && programTableActivated) { actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(3)).setTabListener(this)); mSectionsPagerAdapter.notifyDataSetChanged(); mSectionsPagerAdapter.instantiateItem(mViewPager, 3); } else if (test instanceof ProgramTableFragment) { if (!((ProgramTableFragment) test).checkTimeBlockSize() && !((ProgramTableFragment) test).updateTable()) { ((ProgramTableFragment) test).updateChannelBar(); ((ProgramTableFragment) test).updateMarkings(); } } if (mDebugMenuItem != null) { boolean dataUpdateLogEnabled = PrefUtils.getBooleanValue(R.string.WRITE_DATA_UPDATE_LOG, R.bool.write_data_update_log_default); boolean reminderLogEnabled = PrefUtils.getBooleanValue(R.string.WRITE_REMINDER_LOG, R.bool.write_reminder_log_default); mDebugMenuItem.setVisible(dataUpdateLogEnabled || reminderLogEnabled); mSendDataUpdateLogItem.setEnabled(dataUpdateLogEnabled); mDeleteDataUpdateLogItem.setEnabled(dataUpdateLogEnabled); mSendReminderLogItem.setEnabled(reminderLogEnabled); mDeleteReminderLogItem.setEnabled(reminderLogEnabled); } UiUtils.updateImportantProgramsWidget(getApplicationContext()); UiUtils.updateRunningProgramsWidget(getApplicationContext()); LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(SettingConstants.UPDATE_TIME_BUTTONS)); updateScrollMenu(); if (mUpdateItem != null && !TvDataUpdateService.IS_RUNNING) { if (PrefUtils.getStringValue(R.string.PREF_AUTO_UPDATE_TYPE, R.string.pref_auto_update_type_default) .equals("0")) { mUpdateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } else { mUpdateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); invalidateOptionsMenu(); } } new UpdateAlarmValue().onReceive(TvBrowser.this, null); if (PrefUtils.getBooleanValue(R.string.DARK_STYLE, R.bool.dark_style_default) != SettingConstants.IS_DARK_THEME) { SettingConstants.IS_DARK_THEME = PrefUtils.getBooleanValue(R.string.DARK_STYLE, R.bool.dark_style_default); Favorite.resetMarkIcons(SettingConstants.IS_DARK_THEME); ProgramUtils.resetReminderMarkIcon(SettingConstants.IS_DARK_THEME); PluginServiceConnection[] plugins = PluginHandler.getAvailablePlugins(); for (PluginServiceConnection plugin : plugins) { plugin.loadIcon(); } finish = true; } if (finish) { finish(); } }
From source file:org.tvbrowser.tvbrowser.TvBrowser.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.tv_browser, menu); //new MenuInflater(getSupportActionBar().getThemedContext()).inflate(R.menu.tv_browser, menu); mMainMenu = menu;//from w w w . ja va 2 s.c om // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); mUpdateItem = menu.findItem(R.id.menu_tvbrowser_action_update_data); if (!PrefUtils.getStringValue(R.string.PREF_AUTO_UPDATE_TYPE, R.string.pref_auto_update_type_default) .equals("0")) { mUpdateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } mFilterItem = menu.findItem(R.id.action_filter_channels); mCreateFavorite = menu.findItem(R.id.menu_tvbrowser_action_create_favorite); Fragment fragment = mSectionsPagerAdapter.getItem(mViewPager.getCurrentItem()); mFilterItem.setVisible(!(fragment instanceof FragmentFavorites)); mCreateFavorite.setVisible(fragment instanceof FragmentFavorites); mScrollTimeItem = menu.findItem(R.id.action_scroll); updateFromFilterEdit(); mPluginPreferencesMenuItem = menu.findItem(R.id.menu_tvbrowser_action_settings_plugins); mPluginPreferencesMenuItem.setEnabled(PluginHandler.pluginsAvailable()); menu.findItem(R.id.action_reset).setVisible(TEST_VERSION); mSearchExpanded = false; // if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { addOnActionExpandListener(menu.findItem(R.id.search)); // } // menu.findItem(R.id.action_synchronize_dont_want_to_see).setVisible(false); menu.findItem(R.id.action_synchronize_favorites).setVisible(false); if (mUpdateItem != null && TvDataUpdateService.IS_RUNNING) { updateProgressIcon(true); } mDebugMenuItem = menu.findItem(R.id.action_debug); mSendDataUpdateLogItem = menu.findItem(R.id.action_send_data_update_log); mDeleteDataUpdateLogItem = menu.findItem(R.id.action_delete_data_update_log); mSendReminderLogItem = menu.findItem(R.id.action_send_reminder_log); mDeleteReminderLogItem = menu.findItem(R.id.action_delete_reminder_log); mPauseReminder = menu.findItem(R.id.action_pause_reminder); mContinueReminder = menu.findItem(R.id.action_continue_reminder); mPauseReminder.setVisible(!SettingConstants.isReminderPaused(TvBrowser.this)); mContinueReminder.setVisible(SettingConstants.isReminderPaused(TvBrowser.this)); mScrollTimeItem.setVisible(mViewPager.getCurrentItem() != 2 && !mSearchExpanded); boolean dataUpdateLogEnabled = PrefUtils.getBooleanValue(R.string.WRITE_DATA_UPDATE_LOG, R.bool.write_data_update_log_default); boolean reminderLogEnabled = PrefUtils.getBooleanValue(R.string.WRITE_REMINDER_LOG, R.bool.write_reminder_log_default); mDebugMenuItem.setVisible(dataUpdateLogEnabled || reminderLogEnabled); mSendDataUpdateLogItem.setEnabled(dataUpdateLogEnabled); mDeleteDataUpdateLogItem.setEnabled(dataUpdateLogEnabled); mSendReminderLogItem.setEnabled(reminderLogEnabled); mDeleteReminderLogItem.setEnabled(reminderLogEnabled); updateScrollMenu(); mOptionsMenu = menu; updateSynchroMenu(); return true; }
From source file:org.tvbrowser.tvbrowser.TvBrowser.java
public void updateProgressIcon(final boolean progress) { handler.post(new Runnable() { @Override// www. j a v a2 s. co m public void run() { if (progress) { mUpdateItem.setActionView(R.layout.progressbar); mUpdateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } else { if (!PrefUtils .getStringValue(R.string.PREF_AUTO_UPDATE_TYPE, R.string.pref_auto_update_type_default) .equals("0")) { mUpdateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); invalidateOptionsMenu(); } mUpdateItem.setActionView(null); } } }); }