List of usage examples for android.view MenuItem expandActionView
public boolean expandActionView();
From source file:com.balch.android.app.framework.TemplateActivity.java
public void showProgress() { if (this.optionsMenu != null) { MenuItem menuItem = this.optionsMenu.findItem(R.id.action_bar_menu_refresh); menuItem.setActionView(R.layout.action_bar_progress); menuItem.expandActionView(); }/*from w w w . j ava2s .c o m*/ }
From source file:sk.mpage.androidsample.searchviewtoolbar.SearchActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.close) { startActivity(new Intent(this, MainActivity.class)); return true; } else if (id == R.id.search) { if (query != null) { item.expandActionView(); searchView.setQuery(query, false); }/*from ww w .j a va 2 s . c o m*/ return true; } return super.onOptionsItemSelected(item); }
From source file:fr.cph.chicago.fragment.BikeFragment.java
@Override public final boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { case R.id.action_refresh: SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mActivity); boolean loadBike = sharedPref.getBoolean("divvy_bike", true); if (loadBike) { MenuItem menuItem = item; menuItem.setActionView(R.layout.progressbar); menuItem.expandActionView(); new DivvyAsyncTask().execute(); Bundle bundle = mActivity.getIntent().getExtras(); List<BikeStation> bikeStations = bundle.getParcelableArrayList("bikeStations"); if (bikeStations == null) { mActivity.startRefreshAnimation(); mActivity.new LoadData().execute(); }/*from w w w .ja v a 2 s. c o m*/ } Util.trackAction(mActivity, R.string.analytics_category_ui, R.string.analytics_action_press, R.string.analytics_action_refresh_bike, 0); return false; } return super.onOptionsItemSelected(item); }
From source file:com.xandy.calendar.SearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.search_title_bar, menu); // replace the default top layer drawable of the today icon with a custom drawable // that shows the day of the month of today MenuItem menuItem = menu.findItem(R.id.action_today); if (Utils.isJellybeanOrLater()) { LayerDrawable icon = (LayerDrawable) menuItem.getIcon(); Utils.setTodayIcon(icon, this, Utils.getTimeZone(SearchActivity.this, mTimeChangesUpdater)); } else {//from w w w . j a v a 2 s. c o m menuItem.setIcon(R.drawable.ic_menu_today_no_date_holo_light); } MenuItem item = menu.findItem(R.id.action_search); item.expandActionView(); item.setOnActionExpandListener(this); mSearchView = (SearchView) item.getActionView(); Utils.setUpSearchView(mSearchView, this); mSearchView.setQuery(mQuery, false); mSearchView.clearFocus(); return true; }
From source file:com.commonsware.android.ab.search.ActionBarFragment.java
private void configureSearchView(Menu menu) { MenuItem search = menu.findItem(R.id.search); sv = (SearchView) MenuItemCompat.getActionView(search); sv.setOnQueryTextListener(this); sv.setOnCloseListener(this); sv.setSubmitButtonEnabled(false);//from w w w .jav a2 s . c o m sv.setIconifiedByDefault(true); if (initialQuery != null) { sv.setIconified(false); search.expandActionView(); sv.setQuery(initialQuery, true); } }
From source file:org.openmrs.mobile.activities.syncedpatients.SyncedPatientsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.find_locally_and_add_patients_menu, menu); // Search function MenuItem searchMenuItem = menu.findItem(R.id.actionSearchLocal); if (OpenMRS.getInstance().isRunningHoneycombVersionOrHigher()) { searchView = (SearchView) searchMenuItem.getActionView(); } else {/* w ww. java 2s .c om*/ searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); } if (StringUtils.notEmpty(query)) { searchMenuItem.expandActionView(); searchView.setQuery(query, true); searchView.clearFocus(); } searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { searchView.clearFocus(); return true; } @Override public boolean onQueryTextChange(String query) { mPresenter.setQuery(query); mPresenter.updateLocalPatientsList(); return true; } }); return true; }
From source file:net.ustyugov.jtalk.activity.XMLConsole.java
@Override public boolean onOptionsItemSelected(MenuItem item) { String acc = (String) mPages.get(mPager.getCurrentItem()).getTag(); switch (item.getItemId()) { case android.R.id.home: finish();//from ww w . jav a 2s .c om break; case R.id.search: if (!item.isActionViewExpanded()) { item.expandActionView(); } break; case R.id.clear: XmlListener listener = JTalkService.getInstance().getXmlListener(acc); if (listener != null) listener.clear(); updateList(); break; default: return false; } return true; }
From source file:de.uni_koblenz_landau.apow.PatientListActivity.java
/** * Called by NFCIDReaderTask, when reading is finished. */// w w w. j ava 2s . c o m @Override public void onNFCTagReadingFinished(String patientId) { mNFCIDReaderTask = null; // Set up search in action bar and perform search. MenuItem searchMenuItem = mMenu.findItem(R.id.patient_list_action_search); searchMenuItem.expandActionView(); searchView.setQuery(patientId, true); }
From source file:de.uni_koblenz_landau.apow.PatientListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { mMenu = menu;//from w w w . j av a2s .com getMenuInflater().inflate(R.menu.patient_list, menu); // Set up actionbar search. SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = (SearchView) menu.findItem(R.id.patient_list_action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String query) { if (!query.equals(mLastQuery)) { searchPatients(query, mReset); } mLastQuery = query; return true; } @Override public boolean onQueryTextSubmit(String query) { return false; } }); if (mSavedQuery.length() != 0) { mReset = false; MenuItem searchMenuItem = menu.findItem(R.id.patient_list_action_search); searchMenuItem.expandActionView(); searchView.setQuery(mSavedQuery, false); searchView.clearFocus(); } return super.onCreateOptionsMenu(menu); }
From source file:com.commonsware.android.fts.QuestionsFragment.java
private void configureSearchView(Menu menu) { MenuItem search = menu.findItem(R.id.search); search.setOnActionExpandListener(this); sv = (SearchView) search.getActionView(); sv.setOnQueryTextListener(this); sv.setSubmitButtonEnabled(true);//w ww . j ava2 s. c o m sv.setIconifiedByDefault(true); if (initialQuery != null) { sv.setIconified(false); search.expandActionView(); sv.setQuery(initialQuery, true); } }