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:org.mythdroid.activities.Guide.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItemCompat.setShowAsAction(//from ww w.ja va 2 s.co m menu.add(Menu.NONE, MENU_DATE, Menu.NONE, R.string.chStartDate).setIcon(drawable.ic_menu_today), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setShowAsAction(menu.add(Menu.NONE, MENU_TIME, Menu.NONE, R.string.chStartTime) .setIcon(drawable.ic_menu_recent_history), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); return true; }
From source file:ru.sawimmod.activities.SawimActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear();// w ww . j a v a 2 s .c om ChatView chatView = getChatView(); RosterView rosterView = getRosterView(); StartWindowView startWindowView = (StartWindowView) getSupportFragmentManager() .findFragmentByTag(StartWindowView.TAG); VirtualListView virtualListView = (VirtualListView) getSupportFragmentManager() .findFragmentByTag(VirtualListView.TAG); if (virtualListView != null && virtualListView.isAdded()) { virtualListView.onPrepareOptionsMenu_(menu); return true; } else if (chatView != null && chatView.isAdded() && !SawimApplication.isManyPane()) { chatView.onPrepareOptionsMenu_(menu); return true; } else if ((rosterView != null && rosterView.isAdded()) || (startWindowView != null && startWindowView.isAdded())) { Protocol p = RosterHelper.getInstance().getProtocol(0); if (RosterHelper.getInstance().getProtocolCount() == 1 && p != null) { menu.add(Menu.NONE, RosterHelper.MENU_CONNECT, Menu.NONE, R.string.connect) .setTitle((p.isConnected() || p.isConnecting()) ? R.string.disconnect : R.string.connect); menu.add(Menu.NONE, RosterHelper.MENU_STATUS, Menu.NONE, R.string.status); if (p.getXStatusInfo() != null) menu.add(Menu.NONE, RosterHelper.MENU_XSTATUS, Menu.NONE, R.string.xstatus); if ((p instanceof Icq) || (p instanceof Mrim)) menu.add(Menu.NONE, RosterHelper.MENU_PRIVATE_STATUS, Menu.NONE, R.string.private_status); if (p instanceof Mrim && p.isConnected()) { menu.add(Menu.NONE, RosterHelper.MENU_SEND_SMS, Menu.NONE, R.string.send_sms); } if (p.isConnected()) { if (p instanceof Xmpp) { if (((Xmpp) p).hasS2S()) { menu.add(Menu.NONE, RosterHelper.MENU_DISCO, Menu.NONE, R.string.service_discovery); } menu.add(Menu.NONE, RosterHelper.MENU_ADHOC, Menu.NONE, R.string.account_settings); } menu.add(Menu.NONE, RosterHelper.MENU_GROUPS, Menu.NONE, R.string.manage_contact_list); if (p instanceof Icq) { menu.add(Menu.NONE, RosterHelper.MENU_MYSELF, Menu.NONE, R.string.myself); } else { if (p instanceof Xmpp) { menu.add(Menu.NONE, RosterHelper.MENU_NOTES, Menu.NONE, R.string.notes); } if (p.hasVCardEditor()) menu.add(Menu.NONE, RosterHelper.MENU_MYSELF, Menu.NONE, R.string.myself); if (p instanceof Mrim) menu.add(Menu.NONE, RosterHelper.MENU_MICROBLOG, Menu.NONE, R.string.microblog); } } } menu.add(Menu.NONE, MENU_OPTIONS, Menu.NONE, R.string.options); menu.add(Menu.NONE, MENU_QUIT, Menu.NONE, R.string.quit); } return super.onPrepareOptionsMenu(menu); }
From source file:org.totschnig.myexpenses.activity.AccountEdit.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItemCompat.setShowAsAction(/*w w w . j a va2s. co m*/ menu.add(Menu.NONE, R.id.EXCLUDE_FROM_TOTALS_COMMAND, 0, R.string.menu_exclude_from_totals) .setCheckable(true), MenuItemCompat.SHOW_AS_ACTION_NEVER); return true; }
From source file:org.akvo.flow.activity.SurveyActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.survey_activity, menu); SubMenu subMenu = menu.findItem(R.id.more_submenu).getSubMenu(); if (isReadOnly()) { subMenu.removeItem(R.id.clear);/* ww w. j a va 2 s. c o m*/ } else if (mSurveyGroup.isMonitored()) { // Add 'pre-fill' option, if applies if (mDatabase.getLastSurveyInstance(mRecordId, mSurvey.getId()) != null) { subMenu.add(Menu.NONE, MENU_PREFILL, Menu.NONE, R.string.prefill_title); } } return super.onCreateOptionsMenu(menu); }
From source file:github.daneren2005.dsub.fragments.SubsonicFragment.java
protected void recreateContextMenu(Menu menu) { List<MenuItem> menuItems = new ArrayList<MenuItem>(); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); if (item.isVisible()) { menuItems.add(item);/*from w ww . ja v a 2s .com*/ } } menu.clear(); for (int i = 0; i < menuItems.size(); i++) { MenuItem item = menuItems.get(i); menu.add(tag, item.getItemId(), Menu.NONE, item.getTitle()); } }
From source file:lewa.support.v7.internal.widget.ActionBarContextView.java
private void initTitle() { if (!lewaInitTitle()) { if (mTitleLayout == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); inflater.inflate(R.layout.action_bar_title_item_with_spinner, this); //inflater.inflate(R.layout.abc_action_bar_title_item, this); mTitleLayout = (LinearLayout) getChildAt(getChildCount() - 1); // mTitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_title); // mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle); // if (mTitleStyleRes != 0) { // mTitleView.setTextAppearance(mContext, mTitleStyleRes); // }/*w ww . j ava2 s . c om*/ // if (mSubtitleStyleRes != 0) { // mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes); // } mSpinner = (Button) mTitleLayout.findViewById(R.id.action_bar_spinner); mSpinner.setText("One item selected"); final PopupMenu popMenu = new PopupMenu(mContext, mSpinner); final Menu menu = popMenu.getMenu(); menu.add(Menu.NONE, android.R.id.selectAll, Menu.NONE, android.R.string.selectAll); popMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { if (null != mActionMode) { if (mActionMode instanceof ActionModeImpl) { return ((ActionModeImpl) mActionMode).onMenuItemSelected((MenuBuilder) menu, item); } if (mActionMode instanceof StandaloneActionMode) { return ((StandaloneActionMode) mActionMode).onMenuItemSelected((MenuBuilder) menu, item); } // Woody Guo @ 2012/12/18: State of the selection menu item // is totally controlled by the calling client /* * mActionMode.setSelectionMode( * ActionMode.SELECT_ALL == mActionMode.getSelectionMode() * ? ActionMode.SELECT_NONE : ActionMode.SELECT_ALL); * item.setTitle(ActionMode.SELECT_ALL == mActionMode.getSelectionMode() * ? android.R.string.selectAll : R.string.selectNone); * return true; */ } return false; } }); mSpinner.setOnClickListener(new OnClickListener() { public void onClick(View v) { popMenu.getMenu().getItem(0) .setTitle(ActionMode.SELECT_ALL == mActionMode.getSelectionMode() ? android.R.string.selectAll : R.string.selectNone); popMenu.show(); } }); } mSpinner.setText(mTitle); } if (true) { if (mTitleView != null) { mTitleView.setText(mTitle); } //mSubtitleView.setText(mSubtitle); } final boolean hasTitle = !TextUtils.isEmpty(mTitle); //final boolean hasSubtitle = !TextUtils.isEmpty(mSubtitle); //mSubtitleView.setVisibility(hasSubtitle ? VISIBLE : GONE); //mTitleLayout.setVisibility(hasTitle || hasSubtitle ? VISIBLE : GONE); mTitleLayout.setVisibility(hasTitle ? VISIBLE : GONE); if (mTitleLayout.getParent() == null) { addView(mTitleLayout); } }
From source file:com.jecelyin.editor.v2.ui.MainActivity.java
private void initToolbar() { Resources res = getResources(); mToolbar.setNavigationIcon(R.drawable.ic_drawer_raw); mToolbar.setNavigationContentDescription(R.string.tab); Menu menu = mToolbar.getMenu(); List<MenuItemInfo> menuItemInfos = MenuFactory.getInstance(this).getToolbarIcon(); for (MenuItemInfo item : menuItemInfos) { MenuItem menuItem = menu.add(MenuDef.GROUP_TOOLBAR, item.getItemId(), Menu.NONE, item.getTitleResId()); menuItem.setIcon(MenuManager.makeToolbarNormalIcon(res, item.getIconResId())); //menuItem.setShortcut() menuItem.setOnMenuItemClickListener(this); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); }//w w w . j a v a 2 s . com MenuItem menuItem = menu.add(MenuDef.GROUP_TOOLBAR, R.id.m_menu, Menu.NONE, getString(R.string.more_menu)); menuItem.setIcon(R.drawable.ic_right_menu); menuItem.setOnMenuItemClickListener(this); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); tabManager = new TabManager(this); }
From source file:com.abewy.android.apps.klyph.app.MainActivity.java
public boolean onCreateOptionsMenu(Menu menu) { if (notificationsFragment != null && menu.findItem(R.id.menu_notifications) == null) { final MenuItem notificationItem = menu.add(Menu.NONE, R.id.menu_notifications, 2, R.string.menu_notifications); notificationItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); notificationItem.setActionView(R.layout.actionbar_item_notifications); final TextView notificationTextView = (TextView) notificationItem.getActionView() .findViewById(R.id.textView); int count = notificationsFragment.getUnreadCount(); notificationTextView.setText(String.valueOf(count)); if (count > 0) { notificationTextView/* w w w.j a va 2s . c o m*/ .setBackgroundResource(AttrUtil.getResourceId(this, R.attr.notificationsItemBackground)); } else { notificationTextView.setBackgroundResource(R.drawable.notifications_read_background); } notificationItem.getActionView().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onOptionsItemSelected(notificationItem); } }); } if (!KlyphFlags.IS_PRO_VERSION && menu.findItem(R.id.menu_buy_pro) == null) { menu.add(Menu.NONE, R.id.menu_buy_pro, 2, R.string.menu_buy_pro) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } if (menu.findItem(R.id.menu_faq) == null) { menu.add(Menu.NONE, R.id.menu_faq, Menu.NONE, R.string.menu_faq) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } return super.onCreateOptionsMenu(menu); }
From source file:me.fattycat.kun.teamwork.ui.activity.MainActivity.java
private void initTeamProjectMenu(boolean isClear) { LogUtils.i(TAG, "initTeamProjectMenu"); Menu menu = mNavView.getMenu(); menu.removeGroup(233);/*from w w w.j a v a 2s. com*/ SubMenu projectMenu = menu.addSubMenu(233, Menu.NONE, Menu.NONE, String.format("%s %s", getString(R.string.text_menu_project), TWSettings.sTeamList.get(TWSettings.sSelectedTeamPos).getName())); if (isClear) { projectMenu.add(Menu.NONE, Menu.NONE, Menu.NONE, " ...").setCheckable(true) .setIcon(android.R.color.transparent); return; } int index = 0; for (TeamProjectModel model : mTeamProjectList) { projectMenu.add(Menu.NONE, index++, Menu.NONE, model.getName()).setCheckable(true) .setIcon(android.R.color.transparent); } if (index == 0) { projectMenu.add(Menu.NONE, Menu.NONE, Menu.NONE, "").setCheckable(true) .setIcon(android.R.color.transparent); } }
From source file:org.telegram.ui.SettingsBlockedUsers.java
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { SupportMenuItem item = (SupportMenuItem) menu.add(Menu.NONE, block_user, Menu.NONE, null) .setIcon(R.drawable.plus);//from ww w .j a va2 s .c o m item.setShowAsAction(SupportMenuItem.SHOW_AS_ACTION_ALWAYS); }