本文整理汇总了Java中android.app.VoiceInteractor类的典型用法代码示例。如果您正苦于以下问题:Java VoiceInteractor类的具体用法?Java VoiceInteractor怎么用?Java VoiceInteractor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoiceInteractor类属于android.app包,在下文中一共展示了VoiceInteractor类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
public VoiceInteractor getVoiceInteractor() {
if (mPlugins.isEmpty()) {
return getOriginal().super_getVoiceInteractor();
}
final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size());
final CallFun0<VoiceInteractor> superCall = new CallFun0<VoiceInteractor>(
"getVoiceInteractor()") {
@Override
public VoiceInteractor call() {
if (iterator.hasPrevious()) {
return iterator.previous().getVoiceInteractor(this);
} else {
return getOriginal().super_getVoiceInteractor();
}
}
};
return superCall.call();
}
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:22,代码来源:ActivityDelegate.java
示例2: startVoiceTrigger
import android.app.VoiceInteractor; //导入依赖的package包/类
private void startVoiceTrigger() {
Log.d(TAG, "startVoiceTrigger: ");
Option option = new Option("cheese", 1);
option.addSynonym("ready");
option.addSynonym("go");
option.addSynonym("take it");
option.addSynonym("ok");
VoiceInteractor.Prompt prompt = new VoiceInteractor.Prompt("Say Cheese");
getActivity().getVoiceInteractor()
.submitRequest(new PickOptionRequest(prompt, new Option[]{option}, null) {
@Override
public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
if (finished && selections.length == 1) {
Message message = Message.obtain();
message.obj = result;
takePicture();
} else {
getActivity().finish();
tearDown();
}
}
@Override
public void onCancel() {
getActivity().finish();
tearDown();
}
});
}
开发者ID:googlesamples,项目名称:io2015-codelabs,代码行数:30,代码来源:CameraFragment.java
示例3: Confirm
import android.app.VoiceInteractor; //导入依赖的package包/类
public Confirm(String ttsPrompt, String visualPrompt) {
//super must come first, so their code is well wrong... shocker...
super(new VoiceInteractor.Prompt(
new String[]{ttsPrompt}, visualPrompt
)
, null);
}
开发者ID:JimSeker,项目名称:speech,代码行数:8,代码来源:VoiceInteractionActivity.java
示例4: onConfirmationResult
import android.app.VoiceInteractor; //导入依赖的package包/类
@Override
public void onConfirmationResult(boolean confirmed, Bundle result) {
Bundle status = new Bundle(); //the picture should be in the bundle.
VoiceInteractor.Request request = null;
if (confirmed) {
//here is where we would take the picture. except I'm faking it.
request = new VoiceInteractor.CompleteVoiceRequest(new VoiceInteractor.Prompt("Success"), status);
} else {
request = new VoiceInteractor.AbortVoiceRequest(new VoiceInteractor.Prompt("Too Complex"), status);
}
getVoiceInteractor().submitRequest(request);
finish();
}
开发者ID:JimSeker,项目名称:speech,代码行数:16,代码来源:VoiceInteractionActivity.java
示例5: getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
@Override
public VoiceInteractor getVoiceInteractor() {
return super.getVoiceInteractor();
}
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:5,代码来源:BlueprintActivity.java
示例6: getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
@Override
public VoiceInteractor getVoiceInteractor() {
return delegate.getVoiceInteractor();
}
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:5,代码来源:CompositeActivity.java
示例7: super_getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
@Override
public VoiceInteractor super_getVoiceInteractor() {
return super.getVoiceInteractor();
}
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:5,代码来源:CompositeActivity.java
示例8: getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
public VoiceInteractor getVoiceInteractor() {
verifyMethodCalledFromDelegate("getVoiceInteractor()");
return ((CallFun0<VoiceInteractor>) mSuperListeners.pop()).call();
}
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:5,代码来源:ActivityPlugin.java
示例9: onResume
import android.app.VoiceInteractor; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
Utils.log("onResume: ");
Intent intent = getIntent();
if (intent == null) {
Utils.log("intent is null");
finish();
return;
}
String query = intent.getStringExtra(SearchManager.QUERY);
Utils.log("onResume: Searching for: " + query);
Utils.log("onResume: isVoiceInteraction: " + isVoiceInteraction());
Utils.log("onResume: isVoiceInteractionRoot: " + isVoiceInteractionRoot());
if (isVoiceInteraction()) {
//One option can have many synonyms
VoiceInteractor.PickOptionRequest.Option voiceOption1 =
new VoiceInteractor.PickOptionRequest.Option("Green", 1);
voiceOption1.addSynonym("Olive");
voiceOption1.addSynonym("Emerald");
VoiceInteractor.PickOptionRequest.Option voiceOption2 =
new VoiceInteractor.PickOptionRequest.Option("Red", 1);
voiceOption2.addSynonym("Crimson");
voiceOption2.addSynonym("Burgundy");
//Add as many options as you’d like within the option array, this will increase the chances of //a successful response.
getVoiceInteractor()
.submitRequest(new VoiceInteractor.PickOptionRequest(new VoiceInteractor.Prompt(new String[]{"What is your favorite color?"}, "What is your favorite color?"), new VoiceInteractor.PickOptionRequest.Option[]{voiceOption1, voiceOption2}, null) {
@Override
public void onPickOptionResult(boolean finished, Option[] selections, Bundle result) {
if (finished && selections.length == 1) {
//Use the index of the options array to determine what was said
selections[0].getIndex();
}
}
@Override
public void onCancel() {
getActivity().finish();
}
});
}
finish();
}
开发者ID:Train-Track,项目名称:Train-Track-Android,代码行数:50,代码来源:VoiceActivity.java
示例10: getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
VoiceInteractor getVoiceInteractor();
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:2,代码来源:ICompositeActivity.java
示例11: super_getVoiceInteractor
import android.app.VoiceInteractor; //导入依赖的package包/类
VoiceInteractor super_getVoiceInteractor();
开发者ID:passsy,项目名称:CompositeAndroid,代码行数:2,代码来源:ICompositeActivity.java
注:本文中的android.app.VoiceInteractor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论