From 19a8d63ecc389c0753b411d94e69fec856bbe110 Mon Sep 17 00:00:00 2001 From: sonora Date: Sun, 3 Nov 2019 08:46:32 +0100 Subject: [PATCH] small refactoring of voice engine status variables --- .../plus/development/TestVoiceActivity.java | 6 +++--- .../plus/voice/AbstractPrologCommandPlayer.java | 2 +- .../osmand/plus/voice/TTSCommandPlayerImpl.java | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java index d5aa1c2b9e..758e44f371 100644 --- a/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java @@ -137,11 +137,11 @@ public class TestVoiceActivity extends OsmandActionBarActivity { v += "\n \u25CF OsmAnd voice: " + osmandVoice; v += "\n \u25CF OsmAnd voice language: " + osmandVoiceLang; - v += "\n \u25CF TTS voice language availability: " + (TTSCommandPlayerImpl.getTtsVoiceStatus().equals("") ? "-" : TTSCommandPlayerImpl.getTtsVoiceStatus()); - v += "\n \u25CF TTS voice actually used: " + (TTSCommandPlayerImpl.getTtsVoiceUsed().equals("") ? "-" : TTSCommandPlayerImpl.getTtsVoiceUsed()); + v += "\n \u25CF TTS voice language availability: " + TTSCommandPlayerImpl.getTtsVoiceStatus(); + v += "\n \u25CF TTS voice actually used: " + TTSCommandPlayerImpl.getTtsVoiceUsed(); if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { - v += "\n \u25CF BT SCO: " + (AbstractPrologCommandPlayer.btScoInit.equals("") ? "-" : AbstractPrologCommandPlayer.btScoInit); + v += "\n \u25CF BT SCO: " + AbstractPrologCommandPlayer.btScoInit; } else { v += "\n \u25CF BT SCO: The current app profile is not set to use 'Phone call audio'."; } diff --git a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java index 5ef2f8698a..9aedd2a6e4 100644 --- a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java +++ b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java @@ -326,7 +326,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat //public static final int BT_SCO_DELAY = 1500; // This only needed for init debugging in TestVoiceActivity: - public static String btScoInit = ""; + public static String btScoInit = "-"; private synchronized boolean toggleBtSco(boolean on) { // Hardy, 2016-07-03: Establish a low quality BT SCO (Synchronous Connection-Oriented) link to interrupt e.g. a car stereo FM radio diff --git a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java index 924981c8c2..e6fde98d2f 100644 --- a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java @@ -68,8 +68,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { // TODO: We could actually remove v102 support, I am done updating all existing 35 TTS voices to v103. Hardy, July 2016 private static final Log log = PlatformUtil.getLog(TTSCommandPlayerImpl.class); private static TextToSpeech mTts; - private static String ttsVoiceStatus = ""; - private static String ttsVoiceUsed = ""; + private static String ttsVoiceStatus = "-"; + private static String ttsVoiceUsed = "-"; private Context mTtsContext; private HashMap params = new HashMap(); private VoiceRouter vrt; @@ -175,8 +175,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { } if (mTts == null) { mTtsContext = ctx; - ttsVoiceStatus = ""; - ttsVoiceUsed = ""; + ttsVoiceStatus = "-"; + ttsVoiceUsed = "-"; ttsRequests = 0; final float speechRate = cSpeechRate; @@ -220,7 +220,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { case TextToSpeech.LANG_AVAILABLE: ttsVoiceStatus = newLocale.getDisplayName() + ": LANG_AVAILABLE"; case TextToSpeech.LANG_COUNTRY_AVAILABLE: - ttsVoiceStatus = "".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_AVAILABLE" : ttsVoiceStatus; + ttsVoiceStatus = "-".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_AVAILABLE" : ttsVoiceStatus; case TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE: try { mTts.setLanguage(newLocale); @@ -235,7 +235,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { if(speechRate != 1) { mTts.setSpeechRate(speechRate); } - ttsVoiceStatus = "".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_VAR_AVAILABLE" : ttsVoiceStatus; + ttsVoiceStatus = "-".equals(ttsVoiceStatus) ? newLocale.getDisplayName() + ": LANG_COUNTRY_VAR_AVAILABLE" : ttsVoiceStatus; ttsVoiceUsed = getVoiceUsed(); break; case TextToSpeech.LANG_NOT_SUPPORTED: @@ -320,8 +320,8 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { } abandonAudioFocus(); mTtsContext = null; - ttsVoiceStatus = ""; - ttsVoiceUsed = ""; + ttsVoiceStatus = "-"; + ttsVoiceUsed = "-"; } @Override