|
|
@ -34,6 +34,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
val tag: String = ReadAloudService::class.java.simpleName |
|
|
|
val tag: String = ReadAloudService::class.java.simpleName |
|
|
|
var isRun = false |
|
|
|
var isRun = false |
|
|
|
var textToSpeech: TextToSpeech? = null |
|
|
|
var textToSpeech: TextToSpeech? = null |
|
|
|
|
|
|
|
var timeMinute: Int = 0 |
|
|
|
|
|
|
|
|
|
|
|
fun play( |
|
|
|
fun play( |
|
|
|
context: Context, |
|
|
|
context: Context, |
|
|
@ -101,6 +102,15 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setTimer(context: Context, minute: Int) { |
|
|
|
|
|
|
|
if (isRun) { |
|
|
|
|
|
|
|
val intent = Intent(context, ReadAloudService::class.java) |
|
|
|
|
|
|
|
intent.action = Action.setTimer |
|
|
|
|
|
|
|
intent.putExtra("minute", minute) |
|
|
|
|
|
|
|
context.startService(intent) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun clearTTS() { |
|
|
|
fun clearTTS() { |
|
|
|
textToSpeech?.stop() |
|
|
|
textToSpeech?.stop() |
|
|
|
textToSpeech?.shutdown() |
|
|
|
textToSpeech?.shutdown() |
|
|
@ -124,7 +134,6 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
var pause = false |
|
|
|
var pause = false |
|
|
|
var title: String = "" |
|
|
|
var title: String = "" |
|
|
|
var subtitle: String = "" |
|
|
|
var subtitle: String = "" |
|
|
|
var timeMinute: Int = 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onCreate() { |
|
|
|
override fun onCreate() { |
|
|
|
super.onCreate() |
|
|
|
super.onCreate() |
|
|
@ -243,6 +252,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
handler.removeCallbacks(dsRunnable) |
|
|
|
handler.removeCallbacks(dsRunnable) |
|
|
|
handler.postDelayed(dsRunnable, 6000) |
|
|
|
handler.postDelayed(dsRunnable, 6000) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
postEvent(Bus.TTS_DS, timeMinute) |
|
|
|
ReadAloudNotification.upNotification(this) |
|
|
|
ReadAloudNotification.upNotification(this) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -255,6 +265,7 @@ class ReadAloudService : BaseService(), TextToSpeech.OnInitListener, AudioManage |
|
|
|
handler.postDelayed(dsRunnable, 6000) |
|
|
|
handler.postDelayed(dsRunnable, 6000) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
postEvent(Bus.TTS_DS, timeMinute) |
|
|
|
ReadAloudNotification.upNotification(this) |
|
|
|
ReadAloudNotification.upNotification(this) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|