Exemplo n.º 1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_bot);
    setupComments();
    setupSpeakButton();
    setupCameraButton();
    setupSendCommentButton();
    setupImageDemoButton();

    surfaceView = (SurfaceView) findViewById(R.id.surfaceView);

    cameraControl = new CameraControl(messageHandler);
    cameraControl.init(getApplicationContext(), surfaceView);
    lastpicture = null;

    dialogManager = new DialogManager(this, this, messageHandler);

    dialogManager.setAttitudeCynic(); // happy

    drawingStartLocation = getIntent().getIntExtra(ARG_DRAWING_START_LOCATION, 0);
    if (savedInstanceState == null) {
      contentRoot
          .getViewTreeObserver()
          .addOnPreDrawListener(
              new ViewTreeObserver.OnPreDrawListener() {
                @Override
                public boolean onPreDraw() {
                  contentRoot.getViewTreeObserver().removeOnPreDrawListener(this);
                  startIntroAnimation();
                  return true;
                }
              });
    }

    tts =
        new TextToSpeech(
            getApplicationContext(),
            new TextToSpeech.OnInitListener() {
              @Override
              public void onInit(int status) {
                if (status != TextToSpeech.ERROR) {
                  tts.setLanguage(Locale.US);
                }
              }
            });

    dialogManager.skypeControl.setTts(tts);

    sr = SpeechRecognizer.createSpeechRecognizer(this);
    sr.setRecognitionListener(new STTListener());

    final AIConfiguration config =
        new AIConfiguration(
            "CLIENT_ACCESS_TOKEN_FAIL",
            "SUBSCRIPTION_KEY_FAIL",
            AIConfiguration.SupportedLanguages.English,
            AIConfiguration.RecognitionEngine.System);
  }
Exemplo n.º 2
0
  public void onRadioButtonClicked(View view) {
    // Is the button now checked?
    boolean checked = ((RadioButton) view).isChecked();

    // Check which radio button was clicked
    switch (view.getId()) {
      case R.id.CynicradioButton:
        if (checked) dialogManager.setAttitudeCynic();
        break;
      case R.id.DistantradioButton:
        if (checked) dialogManager.setAttitudeDistant();
        break;
    }
  }