List of usage examples for android.view MenuItem SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
To view the source code for android.view MenuItem SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW.
Click Source Link
From source file:org.codecyprus.android_client.ui.ActivityCurrentQuestion.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(R.string.SKIP)/*from w ww. ja v a2 s. com*/ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); menu.add(R.string.Score_board) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); return true; }
From source file:com.bluros.updater.UpdatesSettings.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, MENU_REFRESH, 0, R.string.menu_refresh).setIcon(R.drawable.ic_menu_refresh) .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); menu.add(0, MENU_DELETE_ALL, 0, R.string.menu_delete_all) .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); menu.add(0, MENU_SYSTEM_INFO, 0, R.string.menu_system_info) .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); return true;/*from ww w.jav a 2 s .co m*/ }
From source file:info.guardianproject.otr.app.im.app.ContactListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.contact_list_menu, menu); mSearchView = SearchViewCompat.newSearchView(this); if (mSearchView != null) { MenuItem item = menu.add("Search").setIcon(android.R.drawable.ic_menu_search) .setActionView(mSearchView); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); SearchViewCompat.setOnQueryTextListener(mSearchView, new SearchViewCompat.OnQueryTextListenerCompat() { @Override/*from ww w . j av a2s . c o m*/ public boolean onQueryTextChange(String newText) { mFilterView.doFilter(newText); return true; } @Override public boolean onQueryTextSubmit(String query) { mFilterView.doFilter(query); return true; } }); } return true; }
From source file:br.com.GUI.aulas.Agenda.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.agenda_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)//w w w . j a v a 2s .c om .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 atualizarAgenda(newText.toString()); } else { // Do something when there's no input atualizarAgenda(newText.toString()); } return false; } @Override public boolean onQueryTextSubmit(String arg0) { // TODO Auto-generated method stub atualizarAgenda(arg0.toString()); return false; } }); }
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 ww w. j av a2 s .c om .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:com.melchor629.musicote.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { //Create the search view SearchView searchView = new SearchView(getActionBar().getThemedContext()); searchView.setQueryHint(getResources().getString(R.string.menu_search)); searchView.setOnQueryTextListener(this); menu.add("Search") .setIcon(new IconDrawable(this, Iconify.IconValue.fa_search).color(Color.WHITE).actionBarSize())//android.R.drawable.ic_menu_search) .setActionView(searchView)/*from w w w .j a v a2s . c o m*/ .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); getMenuInflater().inflate(R.menu.main, menu); menu.findItem(R.id.ajustesm) .setIcon(new IconDrawable(this, Iconify.IconValue.fa_cogs).color(Color.WHITE).actionBarSize()); menu.findItem(R.id.parar) .setIcon(new IconDrawable(this, Iconify.IconValue.fa_music).color(Color.WHITE).actionBarSize()); return true; }
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 v a 2 s .co 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:gov.cdc.epiinfo.RecordList.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = new SearchView(this); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override/*from ww w . j a v a2 s . co m*/ public boolean onQueryTextSubmit(String searchTerm) { try { mDbHelper.fetchTopOne(); String query = BuildQuery(searchTerm); String fieldName1; String fieldName2; String fieldName3; String[] from = new String[1]; int[] to = new int[1]; if (formMetadata.DataFields.size() > 2) { fieldName1 = formMetadata.DataFields.get(0).getName(); fieldName2 = formMetadata.DataFields.get(1).getName(); fieldName3 = formMetadata.DataFields.get(2).getName(); mNotesCursor = mDbHelper.fetchWhere(fieldName1, fieldName2, fieldName3, query); from = new String[] { "_id", "columnName1", fieldName1, "columnName2", fieldName2, "columnName3", fieldName3, "_syncStatus" }; to = new int[] { R.id.text1, R.id.header2, R.id.text2, R.id.header3, R.id.text3, R.id.header4, R.id.text4, R.id.hiddenText }; } else if (formMetadata.DataFields.size() == 2) { fieldName1 = formMetadata.DataFields.get(0).getName(); fieldName2 = formMetadata.DataFields.get(1).getName(); mNotesCursor = mDbHelper.fetchWhere(fieldName1, fieldName2, query); from = new String[] { "_id", "columnName1", fieldName1, "columnName2", fieldName2, "_syncStatus" }; to = new int[] { R.id.text1, R.id.header2, R.id.text2, R.id.header3, R.id.text3, R.id.hiddenText }; } else if (formMetadata.DataFields.size() == 1) { fieldName1 = formMetadata.DataFields.get(0).getName(); mNotesCursor = mDbHelper.fetchWhere(fieldName1, query); from = new String[] { "_id", "columnName1", fieldName1, "_syncStatus" }; to = new int[] { R.id.text1, R.id.header2, R.id.text2, R.id.hiddenText }; } startManagingCursor(mNotesCursor); CustomListAdapter notes = new CustomListAdapter(self, R.layout.line_list_row, mNotesCursor, from, to); lineListFragment.setListAdapter(notes); } catch (Exception ex) { fillData(); } return false; } @Override public boolean onQueryTextChange(String newText) { if (newText.equals("")) { fillData(); } return false; } }); mnuSearch = menu.add(0, SEARCH_ID, 0, R.string.menu_search); mnuSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mnuSearch.setActionView(searchView); mnuSearch.setIcon(gov.cdc.epiinfo.R.drawable.action_search); MenuItem mnuQR = menu.add(0, QR_ID, 1, R.string.menu_barcode); mnuQR.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mnuQR.setIcon(gov.cdc.epiinfo.R.drawable.qrcode_scan); MenuItem mnuCloud = menu.add(0, CLOUD_ID, 2, R.string.menu_cloud_sync); mnuCloud.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem mnuSync = menu.add(0, SYNC_ID, 3, R.string.menu_sync_file); mnuSync.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem mnuDeleteAll = menu.add(0, DELETE_ALL_ID, 4, R.string.menu_delete_all); mnuDeleteAll.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); if (fkeyGuid == null || fkeyGuid.length() == 0) { mnuSetDefault = menu.add(0, SET_DEFAULT_ID, 5, R.string.set_default_form); mnuSetDefault.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); mnuExitDefault = menu.add(0, EXIT_DEFAULT_MODE_ID, 5, R.string.exit_default_form); mnuExitDefault.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); if (AppManager.getDefaultForm().equals("")) { mnuSetDefault.setVisible(true); mnuExitDefault.setVisible(false); } else { mnuSetDefault.setVisible(false); mnuExitDefault.setVisible(true); } } SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); if (sharedPref.getString("cloud_service", "").equals("Box")) { mnuBoxSignin = menu.add(0, BOX_SIGNIN_ID, 6, R.string.box_signin); mnuBoxSignin.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); mnuBoxSignout = menu.add(0, BOX_SIGNOUT_ID, 6, R.string.box_signout); mnuBoxSignout.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); if (BoxClient.isAuthenticated(this)) { mnuBoxSignout.setVisible(true); mnuBoxSignin.setVisible(false); } else { mnuBoxSignout.setVisible(false); mnuBoxSignin.setVisible(true); } } MenuItem mnuHelp = menu.add(1, HELP_ID, 7, R.string.menu_help); mnuHelp.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; }
From source file:com.giltesa.taskcalendar.activity.Main.java
/** * @param searchItem//w ww. ja v a 2s . c o m */ private void setupSearchView(MenuItem searchItem) { searchItem.setShowAsActionFlags( MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView.setOnQueryTextListener(this); }
From source file:com.shafiq.mytwittle.view.BaseLaneActivity.java
protected void configureActionBarSearchView(Menu menu) { MenuItem searchItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) searchItem.getActionView(); searchItem.setShowAsActionFlags(//from ww w . j a v a 2s. c o m MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); mSearchView.setOnQueryTextListener(this); OnFocusChangeListener onFocusChangeListener = new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { mCurrentComposeFragment.setIgnoreFocusChange(true); if (mComposeTweetView != null) { mComposeTweetView.setVisibility(hasFocus ? View.GONE : View.VISIBLE); } if (mComposeDirectMessageView != null) { mComposeDirectMessageView.setVisibility(hasFocus ? View.GONE : View.VISIBLE); } mCurrentComposeFragment.setIgnoreFocusChange(false); } }; mSearchView.setOnQueryTextFocusChangeListener(onFocusChangeListener); mSearchView.setOnFocusChangeListener(onFocusChangeListener); }