コード例 #1
0
 @Override
 public void handleMessage(Message message) {
   switch (message.what) {
     case WHAT_SPEAK:
       String utterance = (String) message.obj;
       mTts.speak(utterance, QUEUING_MODE_INTERRUPT, null);
       return;
     case WHAT_STOP_SPEAK:
       mTts.stop();
       return;
     case WHAT_START_TTS:
       mTts =
           new TextToSpeech(
               mContext,
               new TextToSpeech.OnInitListener() {
                 @Override
                 public void onInit(int status) {
                   // register here since to add earcons the TTS must be initialized
                   // the receiver is called immediately with the current ringer mode
                   registerBroadCastReceiver();
                 }
               });
       return;
     case WHAT_SHUTDOWN_TTS:
       mTts.shutdown();
       return;
     case WHAT_PLAY_EARCON:
       int resourceId = message.arg1;
       playEarcon(resourceId);
       return;
     case WHAT_STOP_PLAY_EARCON:
       mTts.stop();
       return;
   }
 }
コード例 #2
0
ファイル: Effect.java プロジェクト: linhua55/trime
 public void destory() {
   if (mTTS != null) {
     mTTS.stop();
     mTTS.shutdown();
     mTTS = null;
   }
 }
コード例 #3
0
ファイル: AnyMemoTTSImpl.java プロジェクト: joecks/memo
  public void destory() {
    if (speakWord != null) {
      speakWord.destory();
    }

    myTTS.shutdown();
  }
コード例 #4
0
ファイル: MainActivity.java プロジェクト: Desi-Boyz/SayNote
 public void onPause() {
   if (t1 != null) {
     t1.stop();
     t1.shutdown();
   }
   super.onPause();
 }
コード例 #5
0
 @Override
 protected void onDestroy() {
   if (myTTS != null) {
     myTTS.shutdown();
   }
   super.onDestroy();
 }
コード例 #6
0
  /*
   * Code to run ONCE after the driver hits STOP
   */
  @Override
  public void stop() {

    //  add function to clean up status of robot
    textToSpeech.stop();
    textToSpeech.shutdown();
  }
コード例 #7
0
 @Override
 protected void onDestroy() {
   if (tts != null) {
     tts.stop();
     tts.shutdown();
   }
   super.onDestroy();
 }
コード例 #8
0
 @Override
 public void shutdown() {
   if (tts == null) {
     super.shutdown();
     return;
   }
   tts.shutdown();
 }
コード例 #9
0
  public void onDestroy() {
    if (textTalker != null) {
      textTalker.stop();
      textTalker.shutdown();
    }

    super.onDestroy();
  }
 @Override
 public void onDestroy() {
   if (tts != null) {
     tts.stop();
     tts.shutdown();
   }
   super.onDestroy();
 }
コード例 #11
0
 @Override
 public void shutdown() {
   listenToPhoneState(phoneStateListener, PhoneStateListener.LISTEN_NONE);
   if (tts != null) {
     tts.shutdown();
     tts = null;
   }
 }
コード例 #12
0
 @Override
 public void onDestroy() {
   if (textToSpeech != null) {
     textToSpeech.stop();
     textToSpeech.shutdown();
   }
   super.onDestroy();
 }
コード例 #13
0
 /*
  * (non-Javadoc)
  * @see android.app.Activity#onDestroy()
  */
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (speech != null) {
     speech.stop();
     speech.shutdown();
   }
 }
コード例 #14
0
  @Override
  protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();
    Log.i(LOG_STRING, "detach event");

    mTTS.shutdown();
    // serializeMotionEvents();
    // serializeDemonstration();
  }
コード例 #15
0
 @Override
 protected void onDestroy() {
   if (tts != null) {
     tts.stop();
     tts.shutdown();
   }
   unregisterReceiver(mReceiver);
   super.onDestroy();
 }
コード例 #16
0
  @Override
  public void onDestroy() {
    // Don't forget to shutdown!
    if (mTts != null) {
      mTts.stop();
      mTts.shutdown();
    }

    super.onDestroy();
  }
コード例 #17
0
	@Override
	public void onDestroy() {
		stopRingtone = true;
		ttsReady = false;
		if (myTts != null) 
			myTts.shutdown();
		myTts = null;
		if (myRingTonePlayer != null)
			myRingTonePlayer.release();
		myRingTonePlayer = null;
		mServiceLooper.quit();
	} 
コード例 #18
0
ファイル: EngSpaFragment.java プロジェクト: jdenny/Jarden
 @Override // Fragment
 public void onPause() {
   boolean orientationChanged = isOrientationChanged();
   super.onPause();
   if (!orientationChanged && this.textToSpeech != null) {
     textToSpeech.stop();
     textToSpeech.shutdown();
     textToSpeech = null;
     if (BuildConfig.DEBUG)
       Log.d(engSpaActivity.getTag(), "EngSpaFragment.onPause(); textToSpeech closed");
   }
 }
コード例 #19
0
 private synchronized void unregisterBroadcastCall() {
   Log.i(TAG, "unregisterBroadcastCall");
   if (broadcastCall != null) {
     unregisterReceiver(broadcastCall);
     broadcastCall = null;
   }
   tmgr.listen(phoneListener, PhoneStateListener.LISTEN_NONE);
   if (textToSpeech != null) {
     textToSpeech.shutdown();
     textToSpeech = null;
   }
   stopSpeechRecognizer();
 }
コード例 #20
0
  @Override
  protected void onCommandDeactivated() {
    mLocale = null;
    if (mTts != null) {
      try {
        mTts.shutdown();
      } catch (Exception e) {
        // Don't care
      }

      mTts = null;
    }
    mTtsAvailable = false;
  }
コード例 #21
0
ファイル: ShakeService.java プロジェクト: Etsuni/Yuri
 public void onDestroy() {
   super.onDestroy();
   All_In_One.ServiceState(false);
   mShakeDetector.setOnShakeListener(
       new OnShakeListener() {
         @Override
         public void onShake(int count) {
           // Disable
         }
       });
   if (mTts != null) {
     mTts.stop();
     mTts.shutdown();
   }
 }
コード例 #22
0
  @Override
  public void onInit(int status) {
    if (status == TextToSpeech.SUCCESS) {
      // TODO: check if the language is available
      Locale ttsLanguage;
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        ttsLanguage = tts.getDefaultLanguage();
      } else {
        ttsLanguage = tts.getLanguage();
      }

      if (ttsLanguage == null) {
        ttsLanguage = Locale.US;
      }

      int supportStatus = tts.setLanguage(ttsLanguage);
      switch (supportStatus) {
        case TextToSpeech.LANG_MISSING_DATA:
        case TextToSpeech.LANG_NOT_SUPPORTED:
          tts.shutdown();
          tts = null;

          Log.e(TAG, "TTS Language data is not available.");
          Toast.makeText(context, "Unable to set 'Text to Speech' language!", Toast.LENGTH_LONG)
              .show();
          break;
      }

      if (tts != null) {
        tts.setOnUtteranceCompletedListener(mSpeechCompleteListener);
        // Register the broadcast receiver for the speech output period
        // updates
        LocalBroadcastManager.getInstance(context)
            .registerReceiver(
                mSpeechIntervalUpdateReceiver,
                new IntentFilter(SettingsFragment.ACTION_UPDATED_STATUS_PERIOD));
      }
    } else {
      // Notify the user that the tts engine is not available.
      Log.e(TAG, "TextToSpeech initialization failed.");
      Toast.makeText(
              context,
              "Please make sure 'Text to Speech' is enabled in the "
                  + "system accessibility settings.",
              Toast.LENGTH_LONG)
          .show();
    }
  }
コード例 #23
0
  @Override
  protected void onPause() {
    super.onPause();
    if (textToSpeech != null) {
      textToSpeech.stop();
      textToSpeech.shutdown();
    }
    Utilities.setDirectionImage("STOP", ivDirection, bt);
    bt.stop();
    recognizer.cancel();
    // finish();

    if (speech != null) {
      speech.destroy();
    }
  }
コード例 #24
0
  @Override
  protected void onPause() {

    directionThread.interrupt();
    super.onPause();
    if (textToSpeech != null) {
      textToSpeech.stop();
      textToSpeech.shutdown();
    }

    if (mGoogleApiClient.isConnected()) stopLocationUpdates();

    mSensorManager.unregisterListener(this);

    handler1.removeCallbacks(runnable);

    finish();
  }
コード例 #25
0
ファイル: JaneService.java プロジェクト: willwhitney/jane
  @Override
  public void onDestroy() {
    // Cancel the persistent notification.
    notificationManager.cancel(JANE_NOTIFICATION_CODE);

    // disconnect bluetooth proxy
    try {
      bt.releaseProxy();
    } catch (Exception e) {
      e.printStackTrace();
    }

    // close smack
    AsyncTask<Void, Void, Integer> smackShutdown =
        new AsyncTask<Void, Void, Integer>() {

          @Override
          protected Integer doInBackground(Void... params) {
            connection.disconnect();
            return 1;
          }
        };

    smackShutdown.execute();
    smack.onDestroy();

    // unregister JaneIntent receiver
    this.unregisterReceiver(stateIntents);

    // unregister tts
    tts.shutdown();

    // Tell the user we stopped.
    Toast.makeText(this, "Jane service stopped.", Toast.LENGTH_SHORT).show();
    super.onDestroy();
  }
コード例 #26
0
 public void shutdown() {
   ttsInstance.shutdown();
 }
コード例 #27
0
ファイル: Speech.java プロジェクト: qpliu/incant
 public void onStop() {
   textToSpeech.shutdown();
   synchronized (utteranceProgressListener) {
     onDone = null;
   }
 }
コード例 #28
0
 @Test
 public void isShutdown_shouldReturnTrueAfterShutdown() throws Exception {
   textToSpeech.shutdown();
   assertThat(shadowOf(textToSpeech).isShutdown()).isTrue();
 }
コード例 #29
0
ファイル: TextSpeak.java プロジェクト: FluidCoding/Aide
 public void release() {
   txtS.shutdown();
 }
コード例 #30
0
ファイル: MumbleService.java プロジェクト: sidieje/Plumble
  private void doConnectionDisconnect() {
    // First disable all hosts to prevent old callbacks from being
    // processed.
    if (mProtocolHost != null) {
      mProtocolHost.disable();
      mProtocolHost = null;
    }

    if (mConnectionHost != null) {
      mConnectionHost.disable();
      mConnectionHost = null;
    }

    if (mAudioHost != null) {
      mAudioHost.disable();
      mAudioHost = null;
    }

    // Stop threads.
    if (mProtocol != null) {
      mProtocol.stop();
      mProtocol = null;
    }

    if (mClient != null && mClientThread != null) {
      new Thread(
              new Runnable() {
                @Override
                public void run() {
                  mClient.disconnect();
                }
              })
          .start();

      try {
        mClientThread.join();
      } catch (final InterruptedException e) {
        mClientThread.interrupt();
      }

      // Leave mClient reference intact as its state might still be
      // queried.
      mClientThread = null;
    }

    // Broadcast state, this is synchronous with observers.
    state = MumbleConnectionHost.STATE_DISCONNECTED;
    updateConnectionState();

    // Now observers shouldn't need these anymore.
    chatMessages.clear();
    unreadChatMessages.clear();
    users.clear();
    messages.clear();
    channels.clear();

    // Stop wakelock
    if (wakeLock.isHeld()) {
      wakeLock.release();
    }

    if (tts != null) {
      tts.stop();
      tts.shutdown();
    }

    stopSelf();
  }