List of usage examples for android.view MenuItem setVisible
public MenuItem setVisible(boolean visible);
From source file:com.hyperaware.conference.android.activity.MainActivity.java
@Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.main, menu); final MenuItem item = menu.findItem(R.id.mi_fake_date_time); if (item != null) { item.setEnabled(BuildConfig.ALLOW_FAKE_TIME); item.setVisible(BuildConfig.ALLOW_FAKE_TIME); }//from www.ja v a 2 s .c o m super.onCreateOptionsMenu(menu); return true; }
From source file:com.pukulab.puku0x.gscalendar.CalendarActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_calendar, menu); // ???????//w w w . j a va 2s. c om if (mDisplayedUser.usid != null && !mDisplayedUser.usid.equals(mLoginUser.usid)) { // ?? MenuItem menuAdd = menu.findItem(R.id.menu_add); menuAdd.setVisible(false); // ? invalidateOptionsMenu(); } return true; }
From source file:com.zion.htf.ui.fragment.ArtistDetailsFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); MenuItem addAlarmItem = menu.findItem(R.id.action_addAlarm); MenuItem editAlarmItem = menu.findItem(R.id.action_editAlarm); MenuItem toggleFavorite = menu.findItem(R.id.action_toggle_favorite); boolean areAlarmsEnabled = 0 != this.setId; boolean hasAlarm = null != this.alarm; // Add / edit alarm button if (null != addAlarmItem) { addAlarmItem.setVisible(areAlarmsEnabled && !hasAlarm); addAlarmItem.setEnabled(areAlarmsEnabled && !hasAlarm); }// w ww .j a v a2s. co m if (null != editAlarmItem) { editAlarmItem.setVisible(areAlarmsEnabled && hasAlarm); editAlarmItem.setEnabled(areAlarmsEnabled && hasAlarm); } // Favorite button if (this.artist.isFavorite()) { toggleFavorite.setTitle(R.string.action_unset_favorite); toggleFavorite.setIcon(R.drawable.ic_menu_favorite); } else { toggleFavorite.setTitle(R.string.action_set_favorite); toggleFavorite.setIcon(R.drawable.ic_menu_not_favorite); } }
From source file:de.vanita5.twittnuker.activity.support.UserProfileEditorActivity.java
@Override public void onClick(final View view) { if (mUser == null) return;/*from ww w.j ava 2 s . c om*/ if (mPopupMenu != null) { mPopupMenu.dismiss(); } switch (view.getId()) { case ProfileImageBannerLayout.VIEW_ID_PROFILE_IMAGE: { mPopupMenu = PopupMenu.getInstance(this, view); mPopupMenu.inflate(R.menu.action_profile_image); mPopupMenu.setOnMenuItemClickListener(mProfileImageMenuListener); break; } case ProfileImageBannerLayout.VIEW_ID_PROFILE_BANNER: { mPopupMenu = PopupMenu.getInstance(this, view); mPopupMenu.inflate(R.menu.action_profile_banner_image); final Menu menu = mPopupMenu.getMenu(); final MenuItem delete_submenu = menu.findItem(MENU_DELETE_SUBMENU); final boolean has_profile_banner = !isEmpty(mUser.profile_banner_url); delete_submenu.setVisible(has_profile_banner); delete_submenu.setEnabled(has_profile_banner); mPopupMenu.setOnMenuItemClickListener(mProfileBannerImageMenuListener); break; } default: { return; } } mPopupMenu.show(); }
From source file:cn.tycoon.lighttrans.fileManager.AbstractFilePickerFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.picker_actions, menu); MenuItem item = menu.findItem(R.id.action_createdir); item.setVisible(allowCreateDir); }
From source file:com.home.young.filepicker.AbstractFilePickerFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.picker_actions, menu); MenuItem item = menu.findItem(R.id.nnf_action_createdir); item.setVisible(allowCreateDir); }
From source file:at.software2014.trackme.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerLinear); int[] menuItemIds = { R.id.action_map_refresh, R.id.action_friends_refresh, R.id.action_contact_delete, R.id.action_contact_add, R.id.action_contact_invite, R.id.action_zoom_to_friends, R.id.action_zoom_to_me };//ww w . j a v a2 s. c o m for (int i = 0; i < menuItemIds.length; i++) { MenuItem menuItem = menu.findItem(menuItemIds[i]); if (menuItem != null) { menuItem.setVisible(!drawerOpen); } } return super.onPrepareOptionsMenu(menu); }
From source file:at.bitfire.davdroid.ui.AccountActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem itemRename = menu.findItem(R.id.rename_account); // renameAccount is available for API level 21+ itemRename.setVisible(Build.VERSION.SDK_INT >= 21); return super.onPrepareOptionsMenu(menu); }
From source file:com.andrada.sitracker.ui.fragment.DirectoryChooserFragment.java
@Override public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) { inflater.inflate(R.menu.directory_chooser, menu); final MenuItem menuItem = menu.findItem(R.id.new_folder_item); if (menuItem == null) { return;//from w w w. java 2 s. co m } menuItem.setVisible(mInitialDirectory != null && isValidFile(new File(mInitialDirectory)) && mNewDirectoryName != null && mIsDirectoryChooser); }
From source file:com.chatwing.whitelabel.managers.ConversationModeManager.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem notificationItem = menu.findItem(R.id.manage_notification); if (notificationItem != null) { if (mCurrentConversationManager.getCurrentConversation() == null || !mCurrentConversationManager.getCurrentConversation() .allowShowNotification(mUserManager.getCurrentUser()) || mUserManager.getCurrentUser() == null) { notificationItem.setVisible(false); } else {//from ww w . ja va 2s .c o m notificationItem.setVisible(true); } } return true; }