mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-19 02:57:05 +00:00
Use API 21.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.reecedunn.espeak.test;
|
||||
|
||||
import android.os.Build;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.speech.tts.TextToSpeech.OnInitListener;
|
||||
import android.test.AndroidTestCase;
|
||||
@@ -93,4 +94,19 @@ public class TextToSpeechTestCase extends AndroidTestCase
|
||||
{
|
||||
return mEngine;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Locale getLanguage(TextToSpeech engine) {
|
||||
if (engine != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
android.speech.tts.Voice voice = engine.getVoice();
|
||||
if (voice != null) {
|
||||
return voice.getLocale();
|
||||
}
|
||||
} else {
|
||||
return engine.getLanguage();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user