Java Code Examples for android.app.VoiceInteractor#Prompt

The following examples show how to use android.app.VoiceInteractor#Prompt . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public IVoiceInteractorRequest startConfirmation(String callingPackage,
        IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt, Bundle extras) {
    ConfirmationRequest request = new ConfirmationRequest(callingPackage,
            Binder.getCallingUid(), callback, VoiceInteractionSession.this,
            prompt, extras);
    addRequest(request);
    mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_CONFIRMATION,
            request));
    return request.mInterface;
}
 
Example 2
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public IVoiceInteractorRequest startPickOption(String callingPackage,
        IVoiceInteractorCallback callback, VoiceInteractor.Prompt prompt,
        VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
    PickOptionRequest request = new PickOptionRequest(callingPackage,
            Binder.getCallingUid(), callback, VoiceInteractionSession.this,
            prompt, options, extras);
    addRequest(request);
    mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_PICK_OPTION,
            request));
    return request.mInterface;
}
 
Example 3
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public IVoiceInteractorRequest startCompleteVoice(String callingPackage,
        IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) {
    CompleteVoiceRequest request = new CompleteVoiceRequest(callingPackage,
            Binder.getCallingUid(), callback, VoiceInteractionSession.this,
            message, extras);
    addRequest(request);
    mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_COMPLETE_VOICE,
            request));
    return request.mInterface;
}
 
Example 4
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public IVoiceInteractorRequest startAbortVoice(String callingPackage,
        IVoiceInteractorCallback callback, VoiceInteractor.Prompt message, Bundle extras) {
    AbortVoiceRequest request = new AbortVoiceRequest(callingPackage,
            Binder.getCallingUid(), callback, VoiceInteractionSession.this,
            message, extras);
    addRequest(request);
    mHandlerCaller.sendMessage(mHandlerCaller.obtainMessageO(MSG_START_ABORT_VOICE,
            request));
    return request.mInterface;
}
 
Example 5
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
PickOptionRequest(String packageName, int uid, IVoiceInteractorCallback callback,
        VoiceInteractionSession session, VoiceInteractor.Prompt prompt,
        VoiceInteractor.PickOptionRequest.Option[] options, Bundle extras) {
    super(packageName, uid, callback, session, extras);
    mPrompt = prompt;
    mOptions = options;
}
 
Example 6
Source File: CameraFragment.java    From io2015-codelabs with Apache License 2.0 5 votes vote down vote up
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();
            }
        });
}
 
Example 7
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
ConfirmationRequest(String packageName, int uid, IVoiceInteractorCallback callback,
        VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
    super(packageName, uid, callback, session, extras);
    mPrompt = prompt;
}
 
Example 8
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Return the prompt informing the user of what they are picking, as per
 * {@link android.app.VoiceInteractor.PickOptionRequest VoiceInteractor.PickOptionRequest}.
 */
@Nullable
public VoiceInteractor.Prompt getVoicePrompt() {
    return mPrompt;
}
 
Example 9
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
CompleteVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
        VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
    super(packageName, uid, callback, session, extras);
    mPrompt = prompt;
}
 
Example 10
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
AbortVoiceRequest(String packageName, int uid, IVoiceInteractorCallback callback,
        VoiceInteractionSession session, VoiceInteractor.Prompt prompt, Bundle extras) {
    super(packageName, uid, callback, session, extras);
    mPrompt = prompt;
}
 
Example 11
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Return the message informing the user of the problem, as per
 * {@link android.app.VoiceInteractor.AbortVoiceRequest VoiceInteractor.AbortVoiceRequest}.
 */
@Nullable
public VoiceInteractor.Prompt getVoicePrompt() {
    return mPrompt;
}
 
Example 12
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Return the prompt informing the user of what will happen, as per
 * {@link android.app.VoiceInteractor.ConfirmationRequest
 * VoiceInteractor.ConfirmationRequest}.
 */
@Nullable
public VoiceInteractor.Prompt getVoicePrompt() {
    return mPrompt;
}
 
Example 13
Source File: VoiceInteractionSession.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Return the message informing the user of the completion, as per
 * {@link android.app.VoiceInteractor.CompleteVoiceRequest
 * VoiceInteractor.CompleteVoiceRequest}.
 */
@Nullable
public VoiceInteractor.Prompt getVoicePrompt() {
    return mPrompt;
}