* commit '7a5911a96d158567bac1e892aee813af1b563a46': Fix F/C in TTS settings
This commit is contained in:
committed by
Android Git Automerger
commit
cc91f6ff66
@@ -45,6 +45,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
||||||
@@ -277,11 +278,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
|||||||
if (mCurrentDefaultLocale == null || mAvailableStrLocals == null) {
|
if (mCurrentDefaultLocale == null || mAvailableStrLocals == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int defaultAvailable = mTts.setLanguage(mCurrentDefaultLocale);
|
|
||||||
|
|
||||||
|
boolean notInAvailableLangauges = true;
|
||||||
|
try {
|
||||||
// Check if language is listed in CheckVoices Action result as available voice.
|
// Check if language is listed in CheckVoices Action result as available voice.
|
||||||
String defaultLocaleStr = mCurrentDefaultLocale.getISO3Language();
|
String defaultLocaleStr = mCurrentDefaultLocale.getISO3Language();
|
||||||
boolean notInAvailableLangauges = true;
|
|
||||||
if (!TextUtils.isEmpty(mCurrentDefaultLocale.getISO3Country())) {
|
if (!TextUtils.isEmpty(mCurrentDefaultLocale.getISO3Country())) {
|
||||||
defaultLocaleStr += "-" + mCurrentDefaultLocale.getISO3Country();
|
defaultLocaleStr += "-" + mCurrentDefaultLocale.getISO3Country();
|
||||||
}
|
}
|
||||||
@@ -295,7 +296,14 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
if (DBG) Log.wtf(TAG, "MissingResourceException", e);
|
||||||
|
updateEngineStatus(R.string.tts_status_not_supported);
|
||||||
|
updateWidgetState(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int defaultAvailable = mTts.setLanguage(mCurrentDefaultLocale);
|
||||||
if (defaultAvailable == TextToSpeech.LANG_NOT_SUPPORTED ||
|
if (defaultAvailable == TextToSpeech.LANG_NOT_SUPPORTED ||
|
||||||
defaultAvailable == TextToSpeech.LANG_MISSING_DATA ||
|
defaultAvailable == TextToSpeech.LANG_MISSING_DATA ||
|
||||||
notInAvailableLangauges) {
|
notInAvailableLangauges) {
|
||||||
@@ -314,7 +322,6 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask the current default engine to return a string of sample text to be
|
* Ask the current default engine to return a string of sample text to be
|
||||||
* spoken to the user.
|
* spoken to the user.
|
||||||
@@ -357,6 +364,7 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
|||||||
|
|
||||||
private String getDefaultSampleString() {
|
private String getDefaultSampleString() {
|
||||||
if (mTts != null && mTts.getLanguage() != null) {
|
if (mTts != null && mTts.getLanguage() != null) {
|
||||||
|
try {
|
||||||
final String currentLang = mTts.getLanguage().getISO3Language();
|
final String currentLang = mTts.getLanguage().getISO3Language();
|
||||||
String[] strings = getActivity().getResources().getStringArray(
|
String[] strings = getActivity().getResources().getStringArray(
|
||||||
R.array.tts_demo_strings);
|
R.array.tts_demo_strings);
|
||||||
@@ -368,6 +376,10 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment implements
|
|||||||
return strings[i];
|
return strings[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
if (DBG) Log.wtf(TAG, "MissingResourceException", e);
|
||||||
|
// Ignore and fall back to default sample string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return getString(R.string.tts_default_sample_string);
|
return getString(R.string.tts_default_sample_string);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user