Java Code Examples for android.support.v4.view.MenuItemCompat#collapseActionView()
The following examples show how to use
android.support.v4.view.MenuItemCompat#collapseActionView() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From FaceT with Mozilla Public License 2.0 | 6 votes |
@Override public void onBackPressed() { super.onBackPressed(); if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawer(GravityCompat.START); } else if (drawerLayout.isDrawerOpen(GravityCompat.END)) { /*Closes the Appropriate Drawer*/ drawerLayout.closeDrawer(GravityCompat.END); } else { this.finish(); } if (searchView != null && !searchView.isIconified()) { MenuItemCompat.collapseActionView(mMenuItem); return; } }
Example 2
Source File: BuildpropFragment.java From kernel_adiutor with Apache License 2.0 | 6 votes |
@Override public void run() { if (searchItem != null) MenuItemCompat.collapseActionView(searchItem); removeAllViews(); buildpropItem = Buildprop.getProps(); for (int i = 0; i < buildpropItem.size(); i++) { PopupCardView.DPopupCard mPropCard = new PopupCardView.DPopupCard(null); mPropCard.setDescription((String) buildpropItem.keySet().toArray()[i]); mPropCard.setItem((String) buildpropItem.values().toArray()[i]); mPropCard.setOnClickListener(BuildpropFragment.this); addView(mPropCard); } try { getActivity().runOnUiThread(new Runnable() { @Override public void run() { title.setText(getString(R.string.items_found, buildpropItem.size())); refreshLayout.setRefreshing(false); } }); } catch (NullPointerException ignored) { } }
Example 3
Source File: JournalFragment.java From BlackList with Apache License 2.0 | 5 votes |
private void clearSearchView() { if (searchView != null && itemSearch != null) { if (searchView.getQuery().length() > 0) { searchView.setQuery("", false); } MenuItemCompat.collapseActionView(itemSearch); } itemsFilter = ""; }
Example 4
Source File: SearchActivity.java From OpenHub with GNU General Public License v3.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_search, menu); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setOnQueryTextListener(this); searchView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS); searchView.setQuery(mPresenter.getSearchModels().get(0).getQuery(), false); if (isInputMode) { MenuItemCompat.expandActionView(searchItem); } else { MenuItemCompat.collapseActionView(searchItem); } MenuItemCompat.setOnActionExpandListener(searchItem, this); AutoCompleteTextView autoCompleteTextView = searchView .findViewById(android.support.v7.appcompat.R.id.search_src_text); autoCompleteTextView.setThreshold(0); autoCompleteTextView.setAdapter(new ArrayAdapter<>(this, R.layout.layout_item_simple_list, mPresenter.getSearchRecordList())); autoCompleteTextView.setDropDownBackgroundDrawable(new ColorDrawable(ViewUtils.getWindowBackground(getActivity()))); autoCompleteTextView.setOnItemClickListener((parent, view, position, id) -> { onQueryTextSubmit(parent.getAdapter().getItem(position).toString()); }); return super.onCreateOptionsMenu(menu); }
Example 5
Source File: BuildpropFragment.java From kernel_adiutor with Apache License 2.0 | 5 votes |
@Override public boolean onBackPressed() { if (searchItem != null && MenuItemCompat.isActionViewExpanded(searchItem)) { MenuItemCompat.collapseActionView(searchItem); return true; } return false; }
Example 6
Source File: MainActivity.java From android-espresso-dagger-testing with Apache License 2.0 | 5 votes |
@Override public boolean onQueryTextSubmit(String query) { if (!TextUtils.isEmpty(query)) { MenuItemCompat.collapseActionView(searchMenuItem); loadWeatherData(query); } return true; }
Example 7
Source File: SearchFragment.java From Popeens-DSub with GNU General Public License v3.0 | 5 votes |
public void search(final String query, final boolean autoplay, final String artist, final String album, final String title) { if(skipSearch) { skipSearch = false; return; } currentQuery = query; BackgroundTask<SearchResult> task = new TabBackgroundTask<SearchResult>(this) { @Override protected SearchResult doInBackground() throws Throwable { SearchCritera criteria = new SearchCritera(query, MAX_ARTISTS, MAX_ALBUMS, MAX_SONGS); MusicService service = MusicServiceFactory.getMusicService(context); return service.search(criteria, context, this); } @Override protected void done(SearchResult result) { searchResult = result; recyclerView.setAdapter(adapter = new SearchAdapter(context, searchResult, getImageLoader(), largeAlbums, SearchFragment.this)); if (autoplay) { autoplay(query, artist, album, title); } } }; task.execute(); if(searchItem != null) { MenuItemCompat.collapseActionView(searchItem); } }
Example 8
Source File: SearchBook.java From iSCAU-Android with GNU General Public License v3.0 | 5 votes |
@Override public boolean onQueryTextSubmit(String s) { bookadapter = null; page = 1; searchKeyword = s.trim(); searchView.clearFocus(); MenuItemCompat.collapseActionView(menuItemSearch); swipe_refresh.setRefreshing(true); loadData(); return true; }
Example 9
Source File: MainActivity.java From KinoCast with MIT License | 5 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); doSearch(query); MenuItemCompat.collapseActionView(searchMenuItem); } }
Example 10
Source File: BaseActivity.java From open with GNU General Public License v3.0 | 5 votes |
public void toggleDebugMode() { SharedPreferences prefs = getDefaultSharedPreferences(this); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(getString(R.string.settings_key_debug), !isInDebugMode()); editor.commit(); MenuItemCompat.collapseActionView(searchMenuItem); supportInvalidateOptionsMenu(); if (isInDebugMode()) { Toast.makeText(this, getString(R.string.debug_settings_on), Toast.LENGTH_LONG).show(); } else { Toast.makeText(this, getString(R.string.debug_settings_off), Toast.LENGTH_LONG).show(); } }
Example 11
Source File: TeamFragment.java From droidddle with Apache License 2.0 | 4 votes |
private void stopMenuLoading() { MenuItemCompat.collapseActionView(mFollowMenu); MenuItemCompat.setActionView(mFollowMenu, null); }
Example 12
Source File: UserFragment.java From droidddle with Apache License 2.0 | 4 votes |
private void stopMenuLoading() { MenuItemCompat.collapseActionView(mFollowMenu); MenuItemCompat.setActionView(mFollowMenu, null); }
Example 13
Source File: MainActivity.java From Hews with MIT License | 4 votes |
private void collapseSearchViewWhenSwitch() { if (getFragmentManager().findFragmentById(R.id.container) instanceof SearchFragment) { MenuItemCompat.collapseActionView(mSearchItem); mSpinnerSortOrder.setVisibility(View.GONE); } }
Example 14
Source File: PerAppFragment.java From SwipeBack with GNU General Public License v3.0 | 4 votes |
@Override protected void onReturn() { MenuItemCompat.collapseActionView(mSearchItem); }