List of usage examples for android.view MenuItem SHOW_AS_ACTION_IF_ROOM
int SHOW_AS_ACTION_IF_ROOM
To view the source code for android.view MenuItem SHOW_AS_ACTION_IF_ROOM.
Click Source Link
From source file:com.mishiranu.dashchan.ui.navigator.page.PostsPage.java
@Override public void onCreateOptionsMenu(Menu menu) { menu.add(0, OPTIONS_MENU_ADD_POST, 0, R.string.action_add_post).setIcon(obtainIcon(R.attr.actionAddPost)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(0, OPTIONS_MENU_SEARCH, 0, R.string.action_search); menu.add(0, OPTIONS_MENU_GALLERY, 0, R.string.action_gallery); menu.add(0, OPTIONS_MENU_SELECT, 0, R.string.action_select); menu.add(0, OPTIONS_MENU_REFRESH, 0, R.string.action_refresh).setIcon(obtainIcon(R.attr.actionRefresh)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.addSubMenu(0, OPTIONS_MENU_APPEARANCE, 0, R.string.action_appearance); SubMenu threadOptions = menu.addSubMenu(0, OPTIONS_MENU_THREAD_OPTIONS, 0, R.string.action_thread_options); menu.add(0, OPTIONS_MENU_ADD_TO_FAVORITES_TEXT, 0, R.string.action_add_to_favorites); menu.add(0, OPTIONS_MENU_REMOVE_FROM_FAVORITES_TEXT, 0, R.string.action_remove_from_favorites); menu.add(0, OPTIONS_MENU_ADD_TO_FAVORITES_ICON, 0, R.string.action_add_to_favorites) .setIcon(obtainIcon(R.attr.actionAddToFavorites)).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, OPTIONS_MENU_REMOVE_FROM_FAVORITES_ICON, 0, R.string.action_remove_from_favorites) .setIcon(obtainIcon(R.attr.actionRemoveFromFavorites)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(0, OPTIONS_MENU_OPEN_ORIGINAL_THREAD, 0, R.string.action_open_the_original); menu.add(0, OPTIONS_MENU_ARCHIVE, 0, R.string.action_archive_add); threadOptions.add(0, THREAD_OPTIONS_MENU_RELOAD, 0, R.string.action_reload); threadOptions.add(0, THREAD_OPTIONS_MENU_AUTO_REFRESH, 0, R.string.action_auto_refresh).setCheckable(true); threadOptions.add(0, THREAD_OPTIONS_MENU_HIDDEN_POSTS, 0, R.string.action_hidden_posts); threadOptions.add(0, THREAD_OPTIONS_MENU_CLEAR_DELETED, 0, R.string.action_clear_deleted); threadOptions.add(0, THREAD_OPTIONS_MENU_SUMMARY, 0, R.string.action_summary); }
From source file:net.pocketmine.server.HomeActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem log = menu.add(0, CONSOLE_CODE, 0, R.string.title_activity_log).setIcon(R.drawable.hardware_dock); MenuItemCompat.setShowAsAction(log, MenuItem.SHOW_AS_ACTION_IF_ROOM); SubMenu sub = menu.addSubMenu(getString(R.string.abs_settings)); /**//from ww w.ja va 2s . c o m * Set Icon for Submenu */ sub.setIcon(R.drawable.action_settings); /** * Build navigation for submenu */ sub.add(0, VERSION_MANAGER_CODE, 0, getString(R.string.abs_version_manager)); sub.add(0, PROPERTIES_EDITOR_CODE, 0, getString(R.string.abs_properties_editor)); sub.add(0, PLUGINS_CODE, 0, getString(R.string.abs_plugins)); sub.add(0, FORCE_CLOSE_CODE, 0, getString(R.string.abs_force_close)); sub.add(0, ABOUT_US_CODE, 0, getString(R.string.abs_about)); sub.add(0, REINSTALL_PHP_CODE, 0, getString(R.string.php_reinstall)); MenuItem subgrp = sub.getItem(); MenuItemCompat.setShowAsAction(subgrp, MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; }
From source file:com.giltesa.taskcalendar.activity.Main.java
/** * @param searchItem/*from w w w.j a va 2 s. c om*/ */ private void setupSearchView(MenuItem searchItem) { searchItem.setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView.setOnQueryTextListener(this); }
From source file:jp.gr.java_conf.ya.shiobeforandroid3.UpdateTweetDrive.java
@Override public final boolean onCreateOptionsMenu(final Menu menu) { menu.add(0, R.string.get_maplocation, 0, R.string.get_maplocation) .setIcon(android.R.drawable.ic_menu_mylocation).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(0, R.string.deljustbefore, 0, R.string.deljustbefore).setIcon(android.R.drawable.ic_menu_delete) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(0, R.string.settings, 0, R.string.settings).setIcon(android.R.drawable.ic_menu_preferences); menu.add(0, R.string.copyright, 0, R.string.copyright).setIcon(android.R.drawable.ic_menu_info_details); menu.add(0, R.string.back, 0, R.string.back).setIcon(android.R.drawable.ic_menu_close_clear_cancel); return true;//from w w w . j a va 2 s. c o m }
From source file:org.alfresco.mobile.android.application.fragments.favorites.FavoritesSyncFragment.java
public void getMenu(Menu menu) { info = SyncScanInfo.getLastSyncScanData(getActivity(), acc); if (info != null && (info.hasWarning() && !info.hasResponse())) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_SYNC_WARNING, Menu.FIRST + MenuActionItem.MENU_SYNC_WARNING, R.string.sync_warning); mi.setIcon(R.drawable.ic_warning); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }//from ww w .ja v a 2 s . c om mi = menu.add(Menu.NONE, MenuActionItem.MENU_REFRESH, MenuActionItem.MENU_SYNC_WARNING + MenuActionItem.MENU_REFRESH, R.string.refresh); mi.setIcon(R.drawable.ic_refresh); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }
From source file:com.sastra.app.timetable.TimetableActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, 0, 0, "Manage Subjects").setIcon(android.R.drawable.ic_menu_manage) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(1, 1, 1, "Add Class").setIcon(android.R.drawable.ic_menu_add) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(1, 2, 2, "Delete All").setIcon(android.R.drawable.ic_menu_delete) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(1, 3, 3, "About").setIcon(android.R.drawable.ic_menu_info_details) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(1, 4, 4, "Help").setIcon(android.R.drawable.ic_menu_help) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return result; }
From source file:org.alfresco.mobile.android.application.fragments.workflow.task.TaskDetailsFragment.java
public void getMenu(Menu menu) { MenuItem mi;//from ww w . j av a 2 s. c o m String processDefinitionKey = WorkflowUtils.getKeyFromProcessDefinitionId(processDefinitionId); if (endedAt == null && processDefinitionKey.startsWith(WorkflowModel.KEY_PREFIX_ACTIVITI)) { mi = menu.add(Menu.NONE, R.id.menu_process_details, Menu.FIRST, R.string.process_diagram); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } mi = menu.add(Menu.NONE, R.id.menu_process_history, Menu.FIRST + 1, R.string.tasks_history); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); if (currentTask == null || endedAt != null) { return; } // unclaim : I unassign myself (generally created by a pooled process) if (currentTask.getAssigneeIdentifier() != null && WorkflowModel.FAMILY_PROCESS_POOLED_REVIEW.contains(processDefinitionKey)) { mi = menu.add(Menu.NONE, R.id.menu_task_unclaim, Menu.FIRST + 2, R.string.task_unclaim); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT); } // reassign : I have a task and I decide I dont want to be responsible // anymore of this task so I reassign to a specific person else if (currentTask.getAssigneeIdentifier() != null) { mi = menu.add(Menu.NONE, R.id.menu_task_reassign, Menu.FIRST + 3, R.string.task_reassign); mi.setIcon(R.drawable.ic_reassign); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } // claim : I assign to me an unassigned task (created by a pooled // process) else if ((currentTask.getAssigneeIdentifier() == null && WorkflowModel.FAMILY_PROCESS_POOLED_REVIEW.contains(processDefinitionKey)) || "unclaimed".equals(state)) { mi = menu.add(Menu.NONE, R.id.menu_task_claim, Menu.FIRST + 4, R.string.task_claim); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT); } }
From source file:apps.junkuvo.alertapptowalksafely.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // ??/*ww w.ja va 2 s. co m*/ MenuItem actionItem = menu.add(Menu.NONE, MENU_ID.SETTING.ordinal(), MENU_ID.SETTING.ordinal(), this.getString(R.string.menu_title_setting)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); actionItem.setIcon(MENU_ID.SETTING.getDrawableResId()); // Twitter? actionItem = menu.add(Menu.NONE, MENU_ID.TWITTER.ordinal(), MENU_ID.TWITTER.ordinal(), this.getString(R.string.menu_title_share)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); actionItem.setIcon(MENU_ID.TWITTER.getDrawableResId()); // Facebook actionItem = menu.add(Menu.NONE, MENU_ID.FACEBOOK.ordinal(), MENU_ID.FACEBOOK.ordinal(), this.getString(R.string.menu_title_facebook)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); actionItem.setIcon(MENU_ID.FACEBOOK.getDrawableResId()); if (enableNewFunction) { // HISTORY actionItem = menu.add(Menu.NONE, MENU_ID.HISTORY.ordinal(), MENU_ID.HISTORY.ordinal(), this.getString(R.string.menu_title_history)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); actionItem.setIcon(MENU_ID.HISTORY.getDrawableResId()); } // LINE actionItem = menu.add(Menu.NONE, MENU_ID.LINE.ordinal(), MENU_ID.LINE.ordinal(), this.getString(R.string.menu_title_line)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); actionItem.setIcon(MENU_ID.LINE.getDrawableResId()); // FEEDBACK actionItem = menu.add(Menu.NONE, MENU_ID.FEEDBACK.ordinal(), MENU_ID.FEEDBACK.ordinal(), this.getString(R.string.menu_title_feedback)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); actionItem.setIcon(MENU_ID.FEEDBACK.getDrawableResId()); // LICENSE actionItem = menu.add(Menu.NONE, MENU_ID.LICENSE.ordinal(), MENU_ID.LICENSE.ordinal(), this.getString(R.string.menu_title_license)); actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); actionItem.setIcon(MENU_ID.LICENSE.getDrawableResId()); return true; }
From source file:org.alfresco.mobile.android.application.fragments.sync.SyncFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { info = SyncScanInfo.getLastSyncScanData(getActivity(), acc); if (info != null && (info.hasWarning() && !info.hasResponse())) { mi = menu.add(Menu.NONE, R.id.menu_sync_warning, Menu.FIRST, R.string.sync_warning); mi.setIcon(R.drawable.ic_warning); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }//from w w w . j av a2s .c o m MenuFragmentHelper.getMenu(getActivity(), menu); }
From source file:net.henryco.opalette.application.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { topBarButton = menu.add(0, topBarButtonId, 0, ""); topBarButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); topOptButton = menu.add(Menu.NONE, topOptButtonId, Menu.NONE, ""); topOptButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); restoreTopBarButton();//from w w w . j a va2 s. c o m return super.onCreateOptionsMenu(menu); }