Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2015-09-04 17:20:41 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:03:49 +0300
commit33e22b9e989c66050e733dc63d83d458007928cf (patch)
tree9d84c74ef7fb17d1ded6bc230d169cb3eee4c3b7 /android
parentac57f8d4da92af07513664613bcc5c085bf098a0 (diff)
Corrections after colleagues comments.
Diffstat (limited to 'android')
-rw-r--r--android/src/com/mapswithme/maps/sound/TtsPlayer.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/android/src/com/mapswithme/maps/sound/TtsPlayer.java b/android/src/com/mapswithme/maps/sound/TtsPlayer.java
index 89d78bc409..4a45269c25 100644
--- a/android/src/com/mapswithme/maps/sound/TtsPlayer.java
+++ b/android/src/com/mapswithme/maps/sound/TtsPlayer.java
@@ -31,15 +31,15 @@ public enum TtsPlayer
if (!isValid())
return; // TtsPlayer was not inited yet.
- final Locale systemLanguage = getDefaultLocale();
- if (!isLocaleEqual(systemLanguage))
- initTts(systemLanguage);
+ final Locale locale = getDefaultLocale();
+ if (!isLocaleEqual(locale))
+ initTts(locale);
}
private Locale getDefaultLocale()
{
- final Locale systemLanguage = Locale.getDefault();
- return systemLanguage == null ? DEFAULT_LOCALE : systemLanguage;
+ final Locale locale = Locale.getDefault();
+ return locale == null ? DEFAULT_LOCALE : locale;
}
private boolean isLocaleEqual(Locale locale)
@@ -121,9 +121,6 @@ public enum TtsPlayer
private void speak(String textToSpeak)
{
- if (textToSpeak.isEmpty())
- return;
-
// @TODO(vbykoianko) removes these two toasts below when the test period is finished.
Toast.makeText(MwmApplication.get(), textToSpeak, Toast.LENGTH_SHORT).show();
if (mTts.speak(textToSpeak, TextToSpeech.QUEUE_ADD, null) == TextToSpeech.ERROR)
@@ -138,7 +135,6 @@ public enum TtsPlayer
if (!isValid())
return; // speak() is called while TTS is not ready or could not be initialized.
- // TODO think about moving TtsPlayer logic to RoutingLayout to minimize native calls.
final String[] turnNotifications = Framework.nativeGenerateTurnSound();
if (turnNotifications != null)
for (String textToSpeak : turnNotifications)
@@ -158,7 +154,7 @@ public enum TtsPlayer
public void enable(boolean enabled)
{
- if (!isValid())
+ if (enabled && !isValid())
initTts(getDefaultLocale());
nativeEnableTurnNotifications(enabled);
}