|
|
@ -103,9 +103,10 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onDestroy() { |
|
|
|
override fun onDestroy() { |
|
|
|
super.onDestroy() |
|
|
|
textToSpeech?.stop() |
|
|
|
isRun = false |
|
|
|
isRun = false |
|
|
|
unregisterReceiver(broadcastReceiver) |
|
|
|
unregisterReceiver(broadcastReceiver) |
|
|
|
|
|
|
|
super.onDestroy() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { |
|
|
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { |
|
|
@ -120,6 +121,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
"pause" -> pauseReadAloud(true) |
|
|
|
"pause" -> pauseReadAloud(true) |
|
|
|
"resume" -> resumeReadAloud() |
|
|
|
"resume" -> resumeReadAloud() |
|
|
|
"stop" -> stopSelf() |
|
|
|
"stop" -> stopSelf() |
|
|
|
|
|
|
|
else -> stopSelf() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return super.onStartCommand(intent, flags, startId) |
|
|
|
return super.onStartCommand(intent, flags, startId) |
|
|
@ -132,6 +134,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { |
|
|
|
if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) { |
|
|
|
toast(R.string.tts_fix) |
|
|
|
toast(R.string.tts_fix) |
|
|
|
IntentHelp.toTTSSetting(this@ReadAloudService) |
|
|
|
IntentHelp.toTTSSetting(this@ReadAloudService) |
|
|
|
|
|
|
|
stopSelf() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
textToSpeech?.setOnUtteranceProgressListener(TTSUtteranceListener()) |
|
|
|
textToSpeech?.setOnUtteranceProgressListener(TTSUtteranceListener()) |
|
|
|
ttsIsSuccess = true |
|
|
|
ttsIsSuccess = true |
|
|
|