List of usage examples for android.view MenuItem SHOW_AS_ACTION_ALWAYS
int SHOW_AS_ACTION_ALWAYS
To view the source code for android.view MenuItem SHOW_AS_ACTION_ALWAYS.
Click Source Link
From source file:com.crystal.CrystalBeanWallpapers.Wallpaper.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(Menu.NONE, MENU_APPLY, 0, R.string.action_apply).setIcon(android.R.drawable.ic_menu_set_as) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return super.onCreateOptionsMenu(menu); }
From source file:com.awadev.itslearningautologin.MainActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/*from w w w . j a v a2 s . c om*/ public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); mMenuToggleItem = menu.findItem(R.id.action_toggle_menu); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) mMenuToggleItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); if (mToggleMenu) mMenuToggleItem.setIcon(R.drawable.ic_action_collapse); else mMenuToggleItem.setIcon(R.drawable.ic_action_expand); // MenuItem item = menu.findItem(R.id.action_notification_dropdown); // MenuItemCompat.setActionView(item, R.layout.action_bar_notifitcation_icon); // final View menu_hotlist = MenuItemCompat.getActionView(item); // ui_hot = (TextView) menu_hotlist.findViewById(R.id.notification_number); // updateHotCount(5); return super.onCreateOptionsMenu(menu); }
From source file:br.com.GUI.perfil.MeusAlunos.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.adicionar_aluno_actions, menu); final SearchView searchView = new SearchView(getActivity().getActionBar().getThemedContext()); searchView.setQueryHint("Search"); menu.add(Menu.NONE, Menu.NONE, 1, "@string").setIcon(android.R.drawable.ic_menu_search) .setActionView(searchView)//from w w w . j a v a2 s. com .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { if (newText.length() > 0) { // Search atualizarMeusAlunos(newText.toString()); } else { // Do something when there's no input atualizarMeusAlunos(newText.toString()); } return false; } @Override public boolean onQueryTextSubmit(String arg0) { // TODO Auto-generated method stub atualizarMeusAlunos(arg0.toString()); return false; } }); }
From source file:br.com.GUI.perfil.BuscarUsuario.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.buscar_usuario, menu); final SearchView searchView = new SearchView(this.getActionBar().getThemedContext()); searchView.setQueryHint("Search"); menu.add(Menu.NONE, Menu.NONE, 1, "@string").setIcon(android.R.drawable.ic_menu_search) .setActionView(searchView)//from w w w . j a va2 s.c o m .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { /* if (newText.length() > 0) { if(pref.getString("tipo", null).equals("personal")){ pesquisarAluno(newText.toString()); }else if(pref.getString("tipo", null).equals("aluno")){ pesquisarPersonal(newText.toString()); } } else { if(pref.getString("tipo", null).equals("personal")){ pesquisarAluno(""); }else if(pref.getString("tipo", null).equals("aluno")){ pesquisarPersonal(""); } }*/ return false; } @Override public boolean onQueryTextSubmit(String arg0) { if (pref.getString("tipo", null).equals("personal")) { pesquisarAluno(arg0); } else if (pref.getString("tipo", null).equals("aluno")) { pesquisarPersonal(arg0); } return false; } }); return true; }
From source file:com.money.manager.ex.search.SearchParametersFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { UIHelper ui = new UIHelper(getActivity()); // 'Reset' toolbar item inflater.inflate(R.menu.menu_clear, menu); MenuItem item = menu.findItem(R.id.clearMenuItem); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setIcon(ui.getIcon(GoogleMaterial.Icon.gmd_clear)); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.koushikdutta.superuser.FragmentLog.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { VectorDrawableCompat icon = VectorDrawableCompat.create(getContext().getResources(), R.drawable.ic_delete, getContext().getTheme());//from ww w. ja v a2 s . c om if (!Theme.getThemeCurrent(PreferenceManager.getDefaultSharedPreferences(getContext())) .equals(MainActivity.PREF_BLACK_THEME)) { icon.setColorFilter(getActivity() instanceof ActivityLog ? ((ActivityLog) getActivity()).textToolbar : ((MainActivity) getActivity()).textToolbarDefault, PorterDuff.Mode.SRC_ATOP); } else { icon.setColorFilter(0xffeaeaea, PorterDuff.Mode.SRC_ATOP); } if (up == null) { MenuItem delete = menu.add(R.string.delete).setIcon(icon); delete.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); delete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (up != null) SuDatabaseHelper.delete(getActivity(), up); else SuperuserDatabaseHelper.deleteLogs(getActivity()); adapter.clear(); callback.onLogCleared(); //if (up != null) getActivity().finish(); return true; } }); } }
From source file:net.gaast.giggity.ChooserActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(Menu.NONE, 1, 5, R.string.settings).setShortcut('0', 's') .setIcon(R.drawable.ic_settings_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(Menu.NONE, 2, 7, R.string.add_dialog).setShortcut('0', 'a').setIcon(R.drawable.ic_add_white_24dp) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true;//from ww w . j a va 2 s . c o m }
From source file:be.brunoparmentier.openbikesharing.app.activities.StationsListActivity.java
private void setRefreshActionButtonState(final boolean refreshing) { if (optionsMenu != null) { final MenuItem refreshItem = optionsMenu.findItem(R.id.action_refresh); if (refreshItem != null) { if (refreshing) { refreshItem.setActionView(R.layout.actionbar_indeterminate_progress); refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } else { refreshItem.setActionView(null); refreshItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }//from ww w.ja v a 2 s . c o m } } }
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// ww w .ja v a 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: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); }/*from w w w . ja v a 2s .co m*/ 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); }