List of usage examples for android.view MenuItem setVisible
public MenuItem setVisible(boolean visible);
From source file:com.android.contacts.group.GroupMembersFragment.java
private static void setVisible(Context context, Menu menu, int id, boolean visible) { final MenuItem menuItem = menu.findItem(id); if (menuItem != null) { menuItem.setVisible(visible); final Drawable icon = menuItem.getIcon(); if (icon != null) { icon.mutate().setColorFilter(ContextCompat.getColor(context, R.color.actionbar_icon_color), PorterDuff.Mode.SRC_ATOP); }//w ww. j a v a2 s . c om } }
From source file:com.kasungunathilaka.sarigama.fragment.ConnectionFailFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); MenuItem searchItem = menu.findItem(R.id.action_search); searchItem.setVisible(false); MenuItem refreshItem = menu.findItem(R.id.action_refresh); refreshItem.setVisible(false);//from w w w .j av a2 s . c o m }
From source file:cn.jarlen.mediaplayer.sample.activities.RecentMediaActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean show = super.onPrepareOptionsMenu(menu); if (!show)// w w w . j a va 2s . com return show; MenuItem item = menu.findItem(R.id.action_recent); if (item != null) item.setVisible(false); return true; }
From source file:com.example.weix.bluetooth_receive.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem logToggle = menu.findItem(R.id.menu_toggle_log); logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator); logToggle.setTitle(mLogShown ? R.string.sample_show_log : R.string.sample_hide_log); return super.onPrepareOptionsMenu(menu); }
From source file:MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem menuItem = menu.findItem(MENU_DOWNLOAD); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menuItem.setVisible(showDownloadMenu); return true;//w w w .j a v a2s. c o m }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.InAppFlashingActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.actionbar_check, menu); int primary = ContextCompat.getColor(this, R.color.text_color_primary); MenuUtils.tintAllMenuIcons(menu, primary); MenuItem checkItem = menu.findItem(R.id.check_item); if (!mShowCheckIcon) { checkItem.setVisible(false); }//from ww w .j ava 2 s . co m return super.onCreateOptionsMenu(menu); }
From source file:com.justplay1.shoppist.features.currency.CurrencyActivity.java
@Override public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { MenuItem delete = menu.findItem(R.id.menu_delete); delete.setVisible(fragment.isDeleteButtonEnable()); MenuItem checkAll = menu.findItem(R.id.menu_check_all); checkAll.setEnabled(fragment.isCheckAllButtonEnable()); return true;/* w w w . j a va 2 s .c o m*/ }
From source file:com.justplay1.shoppist.features.units.UnitsActivity.java
@Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { super.onPrepareActionMode(mode, menu); MenuItem delete = menu.findItem(R.id.menu_delete); delete.setVisible(fragment.isDeleteButtonEnable()); MenuItem checkAll = menu.findItem(R.id.menu_check_all); checkAll.setEnabled(fragment.isCheckAllButtonEnable()); return true;/*from w w w . ja v a 2 s . c o m*/ }
From source file:com.bellman.bible.android.view.activity.base.actionbar.QuickActionButton.java
protected void update(MenuItem menuItem) { // canShow means must show because we rely on AB logic menuItem.setVisible(canShow()); menuItem.setTitle(getTitle());/*from w w w . j av a2 s. c o m*/ int iconResId = getIcon(); if (iconResId != NO_ICON) { menuItem.setIcon(iconResId); } }
From source file:butter.droid.activities.base.ButterBaseActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_base, menu); BeamManager beamManager = BeamManager.getInstance(this); Boolean castingVisible = mShowCasting && beamManager.hasCastDevices(); MenuItem item = menu.findItem(R.id.action_casting); item.setVisible(castingVisible); item.setIcon(/*from w ww .j a v a 2s. c om*/ beamManager.isConnected() ? R.drawable.ic_av_beam_connected : R.drawable.ic_av_beam_disconnected); return true; }