本文整理汇总了Java中android.support.v17.leanback.app.SearchFragment类的典型用法代码示例。如果您正苦于以下问题:Java SearchFragment类的具体用法?Java SearchFragment怎么用?Java SearchFragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SearchFragment类属于android.support.v17.leanback.app包,在下文中一共展示了SearchFragment类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.v17.leanback.app.SearchFragment; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search);
mFragment = (SearchFragment) getFragmentManager().findFragmentById(R.id.search_fragment);
if (USE_INTERNAL_SPEECH_RECOGNIZER) {
mSpeechRecognitionCallback = new SpeechRecognitionCallback() {
@Override
public void recognizeSpeech() {
if (DEBUG) {
Log.v(TAG, "recognizeSpeech");
}
startActivityForResult(mFragment.getRecognizerIntent(), REQUEST_SPEECH);
}
};
mFragment.setSpeechRecognitionCallback(mSpeechRecognitionCallback);
}
}
示例2: onKeyDown
import android.support.v17.leanback.app.SearchFragment; //导入依赖的package包/类
/**
* Catch the SEARCH key so that the general Android TV search is not launched.
* Try to relaunch the show name search instead
* @param keyCode
* @param event
* @return
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_SEARCH) {
Fragment f = getFragmentManager().findFragmentById(R.id.fragment);
if (f instanceof SearchFragment) {
((SearchFragment)f).startRecognition();
return true;
}
}
return super.onKeyDown(keyCode, event); // default
}
示例3: onKeyDown
import android.support.v17.leanback.app.SearchFragment; //导入依赖的package包/类
/**
* Catch the SEARCH key so that the general Android TV search is not launched.
* Try to relaunch the movie name search instead
* @param keyCode
* @param event
* @return
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_SEARCH) {
Fragment f = getFragmentManager().findFragmentById(R.id.fragment);
if (f instanceof SearchFragment) {
((SearchFragment)f).startRecognition();
return true;
}
}
return super.onKeyDown(keyCode, event); // default
}
示例4: onKeyDown
import android.support.v17.leanback.app.SearchFragment; //导入依赖的package包/类
/**
* Catch the SEARCH key so that the general Android TV search is not launched.
* Try to relaunch the AVP search instead
* @param keyCode
* @param event
* @return
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_SEARCH) {
Fragment f = getFragmentManager().findFragmentById(R.id.video_search_fragment);
if (f instanceof SearchFragment) {
((SearchFragment)f).startRecognition();
return true;
}
}
return super.onKeyDown(keyCode, event); // default
}