Search in sources :

Example 1 with SpeechRecognitionCallback

use of android.support.v17.leanback.widget.SpeechRecognitionCallback in project vlc-android by videolan.

the class SearchFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setSearchResultProvider(this);
    setOnItemViewClickedListener(getDefaultItemClickedListener());
    mDelayedLoad = new SearchRunnable();
    mActivity = getActivity();
    final Intent recognitionIntent = getRecognizerIntent();
    if (Util.isCallable(recognitionIntent)) {
        final SpeechRecognitionCallback speechRecognitionCallback = new SpeechRecognitionCallback() {

            @Override
            public void recognizeSpeech() {
                startActivityForResult(recognitionIntent, REQUEST_SPEECH);
            }
        };
        setSpeechRecognitionCallback(speechRecognitionCallback);
    }
    final Intent intent = mActivity.getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction()) || "com.google.android.gms.actions.SEARCH_ACTION".equals(intent.getAction()))
        onQueryTextSubmit(intent.getStringExtra(SearchManager.QUERY));
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) Intent(android.content.Intent) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) SpeechRecognitionCallback(android.support.v17.leanback.widget.SpeechRecognitionCallback)

Example 2 with SpeechRecognitionCallback

use of android.support.v17.leanback.widget.SpeechRecognitionCallback in project vlc-android by GeoffreyMetais.

the class SearchFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
    setSearchResultProvider(this);
    setOnItemViewClickedListener(getDefaultItemClickedListener());
    mDelayedLoad = new SearchRunnable();
    mActivity = getActivity();
    final Intent recognitionIntent = getRecognizerIntent();
    if (Util.isCallable(recognitionIntent)) {
        final SpeechRecognitionCallback speechRecognitionCallback = new SpeechRecognitionCallback() {

            @Override
            public void recognizeSpeech() {
                startActivityForResult(recognitionIntent, REQUEST_SPEECH);
            }
        };
        setSpeechRecognitionCallback(speechRecognitionCallback);
    }
    final Intent intent = mActivity.getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction()) || "com.google.android.gms.actions.SEARCH_ACTION".equals(intent.getAction()))
        onQueryTextSubmit(intent.getStringExtra(SearchManager.QUERY));
}
Also used : ListRowPresenter(android.support.v17.leanback.widget.ListRowPresenter) Intent(android.content.Intent) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) SpeechRecognitionCallback(android.support.v17.leanback.widget.SpeechRecognitionCallback)

Aggregations

Intent (android.content.Intent)2 ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)2 ListRowPresenter (android.support.v17.leanback.widget.ListRowPresenter)2 SpeechRecognitionCallback (android.support.v17.leanback.widget.SpeechRecognitionCallback)2