• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VoiceInteractor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AVList类代码示例发布时间:2022-05-23
下一篇:
Java CollectionProcessingEngine类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap