List of usage examples for android.view Menu NONE
int NONE
To view the source code for android.view Menu NONE.
Click Source Link
From source file:com.studyjams.mdvideo.PlayerModule.PlayerActivity.java
private void configurePopupWithTracks(PopupMenu popup, final OnMenuItemClickListener customActionClickListener, final int trackType) { if (player == null) { return;//from ww w .j av a 2 s. c o m } int trackCount = player.getTrackCount(trackType); if (trackCount == 0) { return; } popup.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { return (customActionClickListener != null && customActionClickListener.onMenuItemClick(item)) || onTrackItemClick(item, trackType); } }); Menu menu = popup.getMenu(); // ID_OFFSET ensures we avoid clashing with Menu.NONE (which equals 0). menu.add(MENU_GROUP_TRACKS, DemoPlayer.TRACK_DISABLED + ID_OFFSET, Menu.NONE, R.string.off); for (int i = 0; i < trackCount; i++) { menu.add(MENU_GROUP_TRACKS, i + ID_OFFSET, Menu.NONE, buildTrackName(player.getTrackFormat(trackType, i))); } menu.setGroupCheckable(MENU_GROUP_TRACKS, true, true); menu.findItem(player.getSelectedTrack(trackType) + ID_OFFSET).setChecked(true); }
From source file:com.owncloud.android.ui.activity.DrawerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { mIsAccountChooserActive = savedInstanceState.getBoolean(KEY_IS_ACCOUNT_CHOOSER_ACTIVE, false); mCheckedMenuItem = savedInstanceState.getInt(KEY_CHECKED_MENU_ITEM, Menu.NONE); }//from w w w . ja v a2 s .co m mCurrentAccountAvatarRadiusDimension = getResources().getDimension(R.dimen.nav_drawer_header_avatar_radius); mOtherAccountAvatarRadiusDimension = getResources() .getDimension(R.dimen.nav_drawer_header_avatar_other_accounts_radius); mMenuAccountAvatarRadiusDimension = getResources().getDimension(R.dimen.nav_drawer_menu_avatar_radius); }
From source file:org.alfresco.mobile.android.application.fragments.search.SearchFragment.java
public static void getMenu(Menu menu) { MenuItem mi = menu.add(Menu.NONE, R.id.menu_search_option, Menu.FIRST, R.string.search_advanced); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); }
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { itemStartSC = menu.add(0, START_SWIPE_CARD, Menu.NONE, "Swipe Card"); itemStartSC.setEnabled(true);// w ww . j av a2 s.c o m sub = menu.addSubMenu(0, SETTINGS_ITEM, Menu.NONE, "Settings"); itemSubSaveLog = sub.add(0, SUB_SAVE_LOG_ITEM, Menu.NONE, "Save Log option"); itemSubUseAutoConfigProfile = sub.add(1, SUB_USE_AUTOCONFIG_PROFILE, Menu.NONE, "Use AutoConfig profile"); itemSubSelectReader = sub.add(1, SUB_SELECT_READER, Menu.NONE, "Change reader type"); itemSubLoadXML = sub.add(1, SUB_LOAD_XML, Menu.NONE, "Reload XML"); itemSubStartAutoConfig = sub.add(4, SUB_START_AUTOCONFIG, Menu.NONE, "Start AutoConfig"); itemSubStopAutoConfig = sub.add(6, SUB_STOP_AUTOCONFIG, Menu.NONE, "Stop AutoConfig"); sub.add(Menu.NONE, SUB_ATTACHED_TYPE, Menu.NONE, "Get attached type"); sub.add(Menu.NONE, SUB_SUPPORT_STATUS, Menu.NONE, "Get support status"); itemSubSaveLog.setCheckable(true); itemSubUseAutoConfigProfile.setCheckable(true); itemSubLoadXML.setEnabled(true); itemSubStartAutoConfig.setEnabled(true); itemSubStopAutoConfig.setEnabled(true); itemDelLogs = menu.add(0, DELETE_LOG_ITEM, Menu.NONE, "Delete Logs"); itemDelLogs.setEnabled(true); itemAbout = menu.add(0, ABOUT_ITEM, Menu.NONE, "About"); itemAbout.setEnabled(true); itemExitApp = menu.add(0, EXIT_IDT_APP, Menu.NONE, "Exit"); itemExitApp.setEnabled(true); return super.onCreateOptionsMenu(menu); }
From source file:com.googlecode.android_scripting.facade.ui.UiFacade.java
public boolean onPrepareOptionsMenu(Menu menu) { if (mMenuUpdated.getAndSet(false)) { menu.removeGroup(MENU_GROUP_ID); for (UiMenuItem item : mOptionsMenuItems) { MenuItem menuItem = menu.add(MENU_GROUP_ID, Menu.NONE, Menu.NONE, item.mmTitle); if (item.mmIcon != null) { menuItem.setIcon(mService.getResources().getIdentifier(item.mmIcon, "drawable", "android")); }/*from w w w .ja v a 2 s.c o m*/ menuItem.setOnMenuItemClickListener(item.mmListener); } return true; } return true; }
From source file:org.alfresco.mobile.android.application.activity.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (sessionState == SESSION_ERROR && getCurrentSession() == null) { MenuItem mi = menu.add(Menu.NONE, R.id.menu_account_reload, Menu.FIRST, R.string.retry_account_loading); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS); }//from w w w . j a v a 2 s . c o m return super.onCreateOptionsMenu(menu); }
From source file:com.nttec.everychan.ui.presentation.BoardFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); MenuItem itemAddPost = menu.add(Menu.NONE, R.id.menu_add_post, 101, resources .getString(pageType == TYPE_POSTSLIST ? R.string.menu_add_post : R.string.menu_add_thread)); MenuItem itemUpdate = menu.add(Menu.NONE, R.id.menu_update, 102, resources.getString( tabModel.type != TabModel.TYPE_LOCAL ? R.string.menu_update : R.string.menu_from_internet)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { itemAddPost.setIcon(ThemeUtils.getActionbarIcon(activity.getTheme(), resources, R.attr.actionAddPost)); itemUpdate.setIcon(ThemeUtils.getActionbarIcon(activity.getTheme(), resources, R.attr.actionRefresh)); CompatibilityImpl.setShowAsActionIfRoom(itemAddPost); CompatibilityImpl.setShowAsActionIfRoom(itemUpdate); } else {/*from w w w . jav a2s . com*/ itemAddPost.setIcon(R.drawable.ic_menu_edit); itemUpdate.setIcon(R.drawable.ic_menu_refresh); } menu.add(Menu.NONE, R.id.menu_catalog, 103, resources.getString(R.string.menu_catalog)) .setIcon(R.drawable.ic_menu_list); menu.add(Menu.NONE, R.id.menu_search, 104, resources.getString(R.string.menu_search)) .setIcon(android.R.drawable.ic_menu_search); menu.add(Menu.NONE, R.id.menu_save_page, 105, resources.getString(R.string.menu_save_page)) .setIcon(android.R.drawable.ic_menu_save); menu.add(Menu.NONE, R.id.menu_board_gallery, 106, resources.getString(R.string.menu_board_gallery)) .setIcon(android.R.drawable.ic_menu_slideshow); menu.add(Menu.NONE, R.id.menu_quickaccess_add, 107, resources.getString(R.string.menu_quickaccess_add)) .setIcon(R.drawable.ic_menu_add_bookmark); this.menu = menu; updateMenu(); }
From source file:com.owncloud.android.ui.activity.DrawerActivity.java
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mIsAccountChooserActive = savedInstanceState.getBoolean(KEY_IS_ACCOUNT_CHOOSER_ACTIVE, false); mCheckedMenuItem = savedInstanceState.getInt(KEY_CHECKED_MENU_ITEM, Menu.NONE); // (re-)setup drawer state showMenu();/*w w w . j ava 2 s. c o m*/ // check/highlight the menu item if present if (mCheckedMenuItem > Menu.NONE || mCheckedMenuItem < Menu.NONE) { setDrawerMenuItemChecked(mCheckedMenuItem); } }
From source file:org.catnut.fragment.ProfileFragment.java
private void toggleFollow(final boolean follow) { mApp.getRequestQueue()//from ww w . j a va2 s . c o m .add(new CatnutRequest(getActivity(), follow ? FriendshipsAPI.create(mScreenName, null) : FriendshipsAPI.destroy(mScreenName), new UserProcessor.UserProfileProcessor(), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { Toast.makeText(getActivity(), getString(follow ? R.string.follow_success : R.string.unfollow_success), Toast.LENGTH_SHORT).show(); if (follow) { mMenu.removeItem(R.id.action_follow); mMenu.add(Menu.NONE, R.id.action_follow, Menu.NONE, R.string.unfollow) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } else { mMenu.removeItem(R.id.action_unfollow); mMenu.add(Menu.NONE, R.id.action_follow, Menu.NONE, R.string.follow) .setIcon(R.drawable.ic_title_follow) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } mFollowing = !mFollowing; // ? final String str = follow ? "+1" : "-1"; new Thread(new Runnable() { @Override public void run() { long uid = mApp.getAccessToken().uid; String update = "update " + User.TABLE + " SET " + User.friends_count + "=" + User.friends_count + str + " WHERE " + BaseColumns._ID + "=" + uid; getActivity().getContentResolver().update( CatnutProvider.parse(User.MULTIPLE, uid), null, update, null); } }).start(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(getActivity(), error.getLocalizedMessage(), Toast.LENGTH_SHORT) .show(); } })); }
From source file:info.staticfree.android.units.Units.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(Menu.NONE, MENU_REEDIT, Menu.FIRST, R.string.ctx_menu_reedit); menu.add(Menu.NONE, MENU_COPY, Menu.CATEGORY_SYSTEM, android.R.string.copy); menu.add(Menu.NONE, MENU_SEND, Menu.CATEGORY_SYSTEM, R.string.ctx_menu_send); menu.add(Menu.NONE, MENU_USE_RESULT, Menu.CATEGORY_SECONDARY, R.string.ctx_menu_use_result); }