belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
SearchSupportFragment
public
class
SearchSupportFragment
extends Fragment
java.lang.Object | ||
↳ | android.support.v4.app.Fragment | |
↳ | android.support.v17.leanback.app.SearchSupportFragment |
A fragment to handle searches. An application will supply an implementation
of the SearchSupportFragment.SearchResultProvider
interface to handle the search and return
an ObjectAdapter
containing the results. The results are rendered
into a RowsSupportFragment
, in the same way that they are in a BrowseSupportFragment
.
A SpeechRecognizer object will be created for which your application will need to declare
android.permission.RECORD_AUDIO in AndroidManifest file. If app's target version is >= 23 and
the device version is >= 23, a permission dialog will show first time using speech recognition.
0 will be used as requestCode in requestPermissions() call.
setSpeechRecognitionCallback(SpeechRecognitionCallback)
is deprecated.
Speech recognition is automatically started when fragment is created, but
not when fragment is restored from an instance state. Activity may manually
call startRecognition()
, typically in onNewIntent().
Summary
Nested classes | |
---|---|
interface |
SearchSupportFragment.SearchResultProvider
Search API to be provided by the application. |
Public constructors | |
---|---|
SearchSupportFragment()
|
Public methods | |
---|---|
static
Bundle
|
createArgs(Bundle args, String query, String title)
|
static
Bundle
|
createArgs(Bundle args, String query)
|
void
|
displayCompletions(CompletionInfo[] completions)
Displays the completions shown by the IME. |
void
|
displayCompletions(List<String> completions)
Displays the completions shown by the IME. |
Drawable
|
getBadgeDrawable()
Returns the badge drawable in the search bar. |
Intent
|
getRecognizerIntent()
Returns an intent that can be used to request speech recognition. |
RowsSupportFragment
|
getRowsSupportFragment()
Returns RowsSupportFragment that shows result rows. |
String
|
getTitle()
Returns the title set in the search bar. |
static
SearchSupportFragment
|
newInstance(String query)
Creates a search fragment with a given search query. |
void
|
onCreate(Bundle savedInstanceState)
Called to do initial creation of a fragment. |
View
|
onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Called to have the fragment instantiate its user interface view. |
void
|
onDestroy()
Called when the fragment is no longer in use. |
void
|
onPause()
Called when the Fragment is no longer resumed. |
void
|
onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
Callback for the result from requesting permissions. |
void
|
onResume()
Called when the fragment is visible to the user and actively running. |
void
|
onStart()
Called when the Fragment is visible to the user. |
void
|
setBadgeDrawable(Drawable drawable)
Sets the badge drawable that will be shown inside the search bar next to the title. |
void
|
setOnItemViewClickedListener(OnItemViewClickedListener listener)
Sets an item clicked listener for the results. |
void
|
setOnItemViewSelectedListener(OnItemViewSelectedListener listener)
Sets an item selection listener for the results. |
void
|
setSearchAffordanceColors(SearchOrbView.Colors colors)
Sets background color of not-listening state search orb. |
void
|
setSearchAffordanceColorsInListening(SearchOrbView.Colors colors)
Sets background color of listening state search orb. |
void
|
setSearchQuery(String query, boolean submit)
Sets the text of the search query and optionally submits the query. |
void
|
setSearchQuery(Intent intent, boolean submit)
Sets the text of the search query based on the |
void
|
setSearchResultProvider(SearchSupportFragment.SearchResultProvider searchResultProvider)
Sets the search provider that is responsible for returning results for the search query. |
void
|
setSpeechRecognitionCallback(SpeechRecognitionCallback callback)
This method was deprecated in API level 27.1.0. Launching voice recognition activity is no longer supported. App should declare android.permission.RECORD_AUDIO in AndroidManifest file. |
void
|
setTitle(String title)
Sets the title string to be be shown in an empty search bar. |
void
|
startRecognition()
Starts speech recognition. |
Inherited methods | |
---|---|
![]()
android.support.v4.app.Fragment
|