/** * ********************************************************************************************* */ @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_search, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setSubmitButtonEnabled(true); searchView.setQuery(searchText, true); searchView.setIconifiedByDefault(false); searchView.setQueryHint("Search Images .."); SearchView.OnQueryTextListener textChangeListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { return true; } @Override public boolean onQueryTextSubmit(String queryValue) { searchText = queryValue; currentPage = 1; imageItemList.clear(); imageItemAdapter.notifyDataSetChanged(); refreshItems(currentPage); return true; } }; searchView.setOnQueryTextListener(textChangeListener); return true; }
@Override public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.menu_search, menu); mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search)); mSearchView.setOnQueryTextListener(this); mSearchView.setQueryHint(getString(R.string.search_library)); mSearchView.setIconifiedByDefault(false); mSearchView.setIconified(false); MenuItemCompat.setOnActionExpandListener( menu.findItem(R.id.menu_search), new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { finish(); return false; } }); menu.findItem(R.id.menu_search).expandActionView(); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_search, menu); MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { // perform query here SearchTweetsFragment searchTweetsFragment = SearchTweetsFragment.newInstance(query); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_search, searchTweetsFragment); fragmentTransaction.commit(); // Clear the search box searchView.clearFocus(); return true; } @Override public boolean onQueryTextChange(String newText) { return false; } }); return true; }
private void UpdateArtistsOnKeysEntered(View rootView) { final SearchView searchText = (SearchView) rootView.findViewById(R.id.search_text); searchText.setIconifiedByDefault(false); searchText.setQueryHint(getResources().getString(R.string.query_artist_hint)); searchText.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mArtistQuery = searchText.getQuery().toString(); UpdateArtistResults(mArtistQuery); getLoaderManager() .restartLoader( Constants.LOADER_ID.ARTIST_LOADER, null, (ArtistSearchFragment) getFragmentManager().findFragmentById(R.id.fragment_artist_search)); return false; } @Override public boolean onQueryTextChange(String newText) { mArtistQuery = searchText.getQuery().toString(); UpdateArtistResults(mArtistQuery); getLoaderManager() .restartLoader( Constants.LOADER_ID.ARTIST_LOADER, null, (ArtistSearchFragment) getFragmentManager().findFragmentById(R.id.fragment_artist_search)); return false; } }); }
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.action_search, menu); // MenuItem searchItem = menu.findItem(R.id.search); // SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = (SearchView) menu.findItem(R.id.search).getActionView(); // Sets the default or resting state of the search field. If true, a single search icon is shown // by default and // expands to show the text field and other buttons when pressed. Also, if the default state is // iconified, then it // collapses to that state when the close button is pressed. Changes to this property will take // effect immediately. // The default value is true. searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(this); searchView.setOnCloseListener(this); new SearchViewFormatter() // .setSearchBackGroundResource(R.color.actionbar_background) .setSearchIconResource( R.drawable.buscar, false, true) // true to icon inside edittext, false to outside // .setSearchVoiceIconResource(R.drawable.buscar) .setSearchTextColorResource(R.color.actionbar_text) // .setSearchHintColorResource(R.color.actionbar_text) // .setSearchCloseIconResource(R.drawable.buscar) .setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) .format(searchView); return super.onCreateOptionsMenu(menu); }
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); this.menu = menu; MenuInflater inflater = getMenuInflater(); if (mode != PRESENT_VIDEOS_MODE && findViewById(R.id.videoitem_detail_container) == null) { inflater.inflate(R.menu.videoitem_list, menu); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setFocusable(false); searchView.setOnQueryTextListener(new SearchVideoQueryListener()); suggestionListAdapter = new SuggestionListAdapter(this); searchView.setSuggestionsAdapter(suggestionListAdapter); searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView)); if (!searchQuery.isEmpty()) { searchView.setQuery(searchQuery, false); searchView.setIconifiedByDefault(false); } } else if (videoFragment != null) { videoFragment.onCreateOptionsMenu(menu, inflater); } else { inflater.inflate(R.menu.videoitem_two_pannel, menu); } return true; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contactlist); mAppController = AppController.getInstance(); mContext = this; tvHinweis = (TextView) findViewById(R.id.tvHinweis); Toolbar toolbar = (Toolbar) findViewById(R.id.activity_contacts_toolbar); if (toolbar != null) { setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowHomeEnabled(true); // getSupportActionBar().setSubtitle(null); } suggestions = new SearchRecentSuggestions( this, OrderSuggestionProvider.AUTHORITY, OrderSuggestionProvider.MODE); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = new SearchView(getSupportActionBar().getThemedContext()); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(true); searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH); // Lupe anzeigen in der Tastatur // searchView.setSubmitButtonEnabled(true); //OK-Button anzeigen SearchView.SearchAutoComplete searchAutoComplete = (SearchView.SearchAutoComplete) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text); // Collapse the search menu when the user hits the back key searchAutoComplete.setOnFocusChangeListener( new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) showSearch(false); } }); try { // This sets the cursor resource ID to 0 or @null which will make it visible on white // background Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); mCursorDrawableRes.setAccessible(true); mCursorDrawableRes.set(searchAutoComplete, 0); } catch (Exception e) { } checkServerConnection checkServerConnection = new checkServerConnection(); checkServerConnection.execute("qw1"); }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_search, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the options menu from XML MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView mSearchView = (SearchView) menu.findItem(R.id.search_view).getActionView(); mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); mSearchView.setIconifiedByDefault(true); return true; }
public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_search, menu); // SearchView searchView = // (SearchView) menu.findItem(R.id.action_search).getActionView(); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setFocusable(true); searchView.setQueryHint(getString(R.string.action_search_queryHint)); searchView.onActionViewExpanded(); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if (null != searchView) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); searchView.setFocusable(true); } SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { public boolean onQueryTextChange(String newText) { // this is your adapter that will be filtered return true; } public boolean onQueryTextSubmit(String query) { // Here u can get the value "query" which is entered in the search box. String urlEncodedQuery = query.trim(); try { urlEncodedQuery = URLEncoder.encode(query, "UTF-8"); } catch (IOException e) { e.printStackTrace(); } Log.i(LOG_TAG, "URL Encoded query : " + urlEncodedQuery); Intent intent = new Intent(getApplicationContext(), CardListActivity.class); intent.putExtra( CardListActivity.INTENT_EXTRA_LAUNCHER, CardListActivity.LAUNCHER_SEARCH); intent.putExtra(CardListActivity.INTENT_EXTRA_SEARCH_QUERY, urlEncodedQuery); intent.putExtra(CardListActivity.INTENT_EXTRA_TITLE, query); startActivity(intent); return true; } }; searchView.setOnQueryTextListener(queryTextListener); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.map_actions, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); android.support.v7.widget.SearchView searchView = (android.support.v7.widget.SearchView) menu.findItem(R.id.action_search).getActionView(); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_listado_tabs, menu); SearchManager SManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); MenuItem searchMenuItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); mSearchView.setSearchableInfo(SManager.getSearchableInfo(getComponentName())); mSearchView.setIconifiedByDefault(false); mSearchView.setQueryHint("Search..."); mSearchView.setOnQueryTextListener(this); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.search_orders_options_menu, menu); SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconified(false); searchView.setIconifiedByDefault(false); searchView.setClickable(true); searchView.setOnQueryTextListener(this); searchView.setOnClickListener(this); moveSearchIconFromBeginToEnd(searchView); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.search_menu, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); mSearchView = (SearchView) menu.findItem(R.id.search_action_search_view).getActionView(); // Assumes current activity is the searchable activity mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); mSearchView.setIconifiedByDefault(false); mSearchView.setOnQueryTextListener(this); // TODO: Bug with searchView and request focus. Keyboard not showing up. return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.busqueda, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); mSearchView = (SearchView) searchItem.getActionView(); mSearchView.setQueryHint(getString(R.string.search_hint)); mSearchView.setOnQueryTextListener(this); mSearchView.setIconifiedByDefault(false); mSearchView.setIconified(false); SearchView.SearchAutoComplete searchAutoComplete = (SearchView.SearchAutoComplete) mSearchView.findViewById(android.support.v7.appcompat.R.id.search_src_text); searchAutoComplete.setHintTextColor(getResources().getColor(R.color.white_alpha)); return true; }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // Setup search button mSearchItem = menu.findItem(R.id.m_search); mSearchView = (SearchView) mSearchItem.getActionView(); mSearchView.setIconifiedByDefault(true); mSearchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { filter(query); mSearchView.clearFocus(); return true; } @Override public boolean onQueryTextChange(String newText) { mFilterText = newText; filter(newText); return true; } }); MenuItemCompat.setOnActionExpandListener( mSearchItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { filter(null); return true; // Return true to collapse action view } @Override public boolean onMenuItemActionExpand(MenuItem item) { return true; // Return true to expand action view } }); if (mPreviousQuery != null && !mPreviousQuery.isEmpty()) { search(mPreviousQuery); filter(mPreviousQuery); mSearchView.clearFocus(); } }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_search, menu); final MenuItem item = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(item); if (type == Constant.NOTEBOOK_SEARCH) { searchView.setQueryHint(getString(R.string.search_notebook_hint)); } else if (type == Constant.BLOG_SEARCH) { searchView.setQueryHint(getString(R.string.search_blog_hint)); } else { searchView.setQueryHint(getString(R.string.search_note_hint)); } searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(this); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (!Utils.isTablet(getActivity())) setHasOptionsMenu(true); this.inflate = inflater; v = inflater.inflate(R.layout.udobra_list, null); listView = (ExpandableListView) v.findViewById(R.id.expandableListView); listView.setGroupIndicator(null); if (Utils.LOCALE.equals("ru")) { AssetsHelper assetsHelper = new AssetsHelper(getActivity()); db = assetsHelper.getReadableDatabase(); } else { DBHelper dbHelper = new DBHelper(getActivity()); db = dbHelper.getReadableDatabase(); } searchView = (android.support.v7.widget.SearchView) v.findViewById(R.id.searchV); searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(this); searchView.setSubmitButtonEnabled(false); searchView.setQueryHint(getResources().getString(R.string.Search)); MultiSpinner multiSpinner = (MultiSpinner) v.findViewById(R.id.filterSpinner); Map<Integer, String> filter = new HashMap<Integer, String>(); filter.put(1, getResources().getString(R.string.Favorites)); filter.put(2, getResources().getString(R.string.Added)); multiSpinner.setItems(getResources().getString(R.string.Filter), this, filter, 1); fillData(0); listView.setOnGroupExpandListener( new ExpandableListView.OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { if (lastExpandedPosition != -1 && groupPosition != lastExpandedPosition) { listView.collapseGroup(lastExpandedPosition); } lastExpandedPosition = groupPosition; } }); return v; }
@Override public boolean onCreateOptionsMenu(Menu menu) { if (!mNavigationDrawerFragment.isDrawerOpen()) { // Only show items in the action bar relevant to this screen // if the drawer is not showing. Otherwise, let the drawer // decide what to show in the action bar. getMenuInflater().inflate(R.menu.main, menu); MenuItem searchItem = menu.findItem(R.id.action_search); searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setQueryHint("두 자 이상 입력하세요"); searchView.setOnQueryTextListener(queryTextListener); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if (null != searchManager) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } // 검색필드를 항상 표시하고싶을 경우false, 아이콘으로 보이고 싶을 경우 true searchView.setIconifiedByDefault(true); restoreActionBar(); return true; } return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_ads_list, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); MenuItem searchMenuItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); searchView.setIconifiedByDefault(false); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setOnQueryTextListener( new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String query) { final ArrayList<AdsItem> filteredAdsList; filteredAdsList = searchFilter(mAdsList, query); if (filteredAdsList.size() > 0) { mAdsListRecycler.setVisibility(View.VISIBLE); mEmptySearch.setVisibility(View.GONE); } else { mAdsListRecycler.setVisibility(View.GONE); mEmptySearch.setVisibility(View.VISIBLE); } mAdapter.animateTo(filteredAdsList); mAdsListRecycler.scrollToPosition(0); return true; } }); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_truck_list, menu); // MenuItem searchItem = menu.findItem(R.id.action_search); // final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); // searchView.setOnSearchClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) // { // Log.i("stuff", searchView.getQuery().toString()); // } // }); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); if (null != searchView) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); } SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { public boolean onQueryTextChange(String newText) { // this is your adapter that will be filtered return true; } public boolean onQueryTextSubmit(String query) { // Here u can get the value "query" which is entered in the search box. Log.i("stuff", query); return true; } }; searchView.setOnQueryTextListener(queryTextListener); return super.onCreateOptionsMenu(menu); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_main_search, menu); // removed to not double the menu items MenuItem item = menu.findItem(R.id.menu_search); SearchView sv = new SearchView(((MainActivity) getActivity()).getSupportActionBar().getThemedContext()); MenuItemCompat.setShowAsAction( item, MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setActionView(item, sv); sv.setOnQueryTextListener(this); sv.setIconifiedByDefault(false); sv.setOnSearchClickListener( new View.OnClickListener() { @Override public void onClick(View view) {} }); MenuItemCompat.setOnActionExpandListener( item, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { // Do something when collapsed return true; // Return true to collapse action view } @Override public boolean onMenuItemActionExpand(MenuItem item) { // Do something when expanded return true; // Return true to expand action view } }); super.onCreateOptionsMenu(menu, inflater); }
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.menu_info, menu); MenuItem menuItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); MenuItemCompat.setOnActionExpandListener( menuItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { // Do something when collapsed getSupportFragmentManager().popBackStack(); return true; // Return true to collapse action view } @Override public boolean onMenuItemActionExpand(MenuItem item) { // Do something when expanded getSupportFragmentManager() .beginTransaction() .add(R.id.container, petsListFragment) .addToBackStack("PetsListFragment") .commit(); return true; // Return true to expand action view } }); // Get the SearchView and set the searchable configuration // Assumes current activity is the searchable activity // searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(true); // Do not iconify the widget; expand it by default searchView.setOnQueryTextListener(this); return true; }
private void setupSearchView() { searchView.setIconifiedByDefault(true); searchView.setOnQueryTextListener(this); searchView.setSubmitButtonEnabled(false); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_videoitem_list); StreamingService streamingService = null; View bg = findViewById(R.id.mainBG); bg.setVisibility(View.VISIBLE); try { // ------ todo: remove this line when multiservice support is implemented ------ currentStreamingServiceId = ServiceList.getIdOfService("Youtube"); streamingService = ServiceList.getService(currentStreamingServiceId); } catch (Exception e) { e.printStackTrace(); ErrorActivity.reportError( VideoItemListActivity.this, e, null, findViewById(R.id.videoitem_list), ErrorActivity.ErrorInfo.make( ErrorActivity.SEARCHED, ServiceList.getNameOfService(currentStreamingServiceId), "", R.string.general_error)); } setVolumeControlStream(AudioManager.STREAM_MUSIC); listFragment = (VideoItemListFragment) getSupportFragmentManager().findFragmentById(R.id.videoitem_list); listFragment.setStreamingService(streamingService); if (savedInstanceState != null && mode != PRESENT_VIDEOS_MODE) { searchQuery = savedInstanceState.getString(QUERY); currentStreamingServiceId = savedInstanceState.getInt(STREAMING_SERVICE); if (!searchQuery.isEmpty()) { listFragment.search(searchQuery); } } if (findViewById(R.id.videoitem_detail_container) != null) { // The detail container view will be present only in the // large-screen layouts (res/values-large and // res/values-sw600dp). If this view is present, then the // activity should be in two-pane mode. mTwoPane = true; // In two-pane mode, list items should be given the // 'activated' state when touched. ((VideoItemListFragment) getSupportFragmentManager().findFragmentById(R.id.videoitem_list)) .setActivateOnItemClick(true); SearchView searchView = (SearchView) findViewById(R.id.searchViewTablet); if (mode != PRESENT_VIDEOS_MODE) { // Somehow the seticonifiedbydefault property set by the layout xml is not working on // the support version on SearchView, so it needs to be set programmatically. searchView.setIconifiedByDefault(false); searchView.setIconified(false); if (!searchQuery.isEmpty()) { searchView.setQuery(searchQuery, false); } searchView.setOnQueryTextListener(new SearchVideoQueryListener()); suggestionListAdapter = new SuggestionListAdapter(this); searchView.setSuggestionsAdapter(suggestionListAdapter); searchView.setOnSuggestionListener(new SearchSuggestionListener(searchView)); } else { searchView.setVisibility(View.GONE); } } PreferenceManager.setDefaultValues(this, R.xml.settings, false); }