mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 00:48:29 -04:00
Fix for text to speech crash #457
This commit is contained in:
parent
b7f7d2524f
commit
b70acca2b6
@ -161,4 +161,5 @@
|
|||||||
<string name="confirm_stop_download_title">Stop download?</string>
|
<string name="confirm_stop_download_title">Stop download?</string>
|
||||||
<string name="confirm_stop_download_msg">Are you sure you want to stop this download?</string>
|
<string name="confirm_stop_download_msg">Are you sure you want to stop this download?</string>
|
||||||
<string name="download_change_storage">Storage device selector</string>
|
<string name="download_change_storage">Storage device selector</string>
|
||||||
|
<string name="tts_not_enabled">Text to speech is not enabled for this ZIM file</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -84,11 +84,19 @@ public class KiwixTextToSpeech {
|
|||||||
} else {
|
} else {
|
||||||
Locale locale = LanguageUtils.ISO3ToLocale(ZimContentProvider.getLanguage());
|
Locale locale = LanguageUtils.ISO3ToLocale(ZimContentProvider.getLanguage());
|
||||||
int result;
|
int result;
|
||||||
|
if (ZimContentProvider.getLanguage().equals("mul")) {
|
||||||
|
Log.d(TAG_KIWIX, "TextToSpeech: disabled " +
|
||||||
|
ZimContentProvider.getLanguage());
|
||||||
|
Toast.makeText(context,
|
||||||
|
context.getResources().getString(R.string.tts_not_enabled),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (locale == null
|
if (locale == null
|
||||||
|| (result = tts.isLanguageAvailable(locale)) == TextToSpeech.LANG_MISSING_DATA
|
|| (result = tts.isLanguageAvailable(locale)) == TextToSpeech.LANG_MISSING_DATA
|
||||||
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
|
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
|
||||||
Log.d(TAG_KIWIX, "TextToSpeech: language not supported: " +
|
Log.d(TAG_KIWIX, "TextToSpeech: language not supported: " +
|
||||||
ZimContentProvider.getLanguage() + " (" + locale.getLanguage() + ")");
|
ZimContentProvider.getLanguage());
|
||||||
Toast.makeText(context,
|
Toast.makeText(context,
|
||||||
context.getResources().getString(R.string.tts_lang_not_supported),
|
context.getResources().getString(R.string.tts_lang_not_supported),
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user