public static class FindNetworkActivity.FindLanguageFragment
extends Fragment
implements android.widget.SearchView.OnQueryTextListener
Modifier and Type | Field and Description |
---|---|
private SearchAdapter<org.codethechange.culturemesh.models.Language> |
adapter
The adapter that populates
searchList with results |
private static java.lang.String |
ARG_SECTION_NUMBER
The fragment argument representing the section number for this
fragment.
|
private android.widget.ListView |
searchList
The displayed list of search results
|
private android.widget.SearchView |
searchView
The field into which user enters search queries
|
Constructor and Description |
---|
FindLanguageFragment()
Empty constructor that does nothing.
|
Modifier and Type | Method and Description |
---|---|
static FindNetworkActivity.FindLanguageFragment |
newInstance(int sectionNumber)
Returns a new instance of this fragment for the given section
number.
|
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
Create the displayed fragment.
|
boolean |
onQueryTextChange(java.lang.String newText)
When the query text changes, do nothing to avoid expensive API calls.
|
boolean |
onQueryTextSubmit(java.lang.String query)
When the user submits a query, call
search() |
void |
search()
Use
API.Get#autocompleteLanguage(RequestQueue, String, Response.Listener) to get
autocomplete results for the user's query. |
private android.widget.ListView searchList
private SearchAdapter<org.codethechange.culturemesh.models.Language> adapter
searchList
with resultsprivate android.widget.SearchView searchView
private static final java.lang.String ARG_SECTION_NUMBER
public FindLanguageFragment()
public static FindNetworkActivity.FindLanguageFragment newInstance(int sectionNumber)
public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
inflater
- Creates the user interface from R.layout#fragment_find_language
container
- Parent container to attach inflated View
tosavedInstanceState
- Previous state that is not used.public void search()
API.Get#autocompleteLanguage(RequestQueue, String, Response.Listener)
to get
autocomplete results for the user's query. Pass those results to
adapter
, which will then populate
searchList
public boolean onQueryTextSubmit(java.lang.String query)
search()
onQueryTextSubmit
in interface android.widget.SearchView.OnQueryTextListener
query
- Query text that is discarded.true
public boolean onQueryTextChange(java.lang.String newText)
onQueryTextChange
in interface android.widget.SearchView.OnQueryTextListener
newText
- The updated query text.true
.