Bug fixed in TTS
This commit is contained in:
parent
6a7875cc61
commit
a6c6dfc6ba
@ -11,8 +11,8 @@ android {
|
|||||||
compileSdkVersion 31
|
compileSdkVersion 31
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
versionCode 125
|
versionCode 126
|
||||||
versionName "1.7.10"
|
versionName "1.7.11"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import com.jens.automation2.receivers.PhoneStatusListener;
|
|||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ import java.util.Set;
|
|||||||
public class AutomationService extends Service implements OnInitListener
|
public class AutomationService extends Service implements OnInitListener
|
||||||
{
|
{
|
||||||
protected TextToSpeech ttsEngine = null;
|
protected TextToSpeech ttsEngine = null;
|
||||||
|
protected int ttsStatus = -1;
|
||||||
protected final static int notificationId = 1000;
|
protected final static int notificationId = 1000;
|
||||||
protected final static int notificationIdRestrictions = 1005;
|
protected final static int notificationIdRestrictions = 1005;
|
||||||
protected final static int notificationIdLocationRestriction = 1006;
|
protected final static int notificationIdLocationRestriction = 1006;
|
||||||
@ -97,6 +99,11 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
this.lockSoundChangesEnd = lockSoundChangesEnd;
|
this.lockSoundChangesEnd = lockSoundChangesEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTtsStatus()
|
||||||
|
{
|
||||||
|
return ttsStatus;
|
||||||
|
}
|
||||||
|
|
||||||
protected final IBinder myBinder = new LocalBinder();
|
protected final IBinder myBinder = new LocalBinder();
|
||||||
|
|
||||||
protected LocationProvider myLocationProvider;
|
protected LocationProvider myLocationProvider;
|
||||||
@ -317,8 +324,26 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
if (Settings.useTextToSpeechOnNormal || Settings.useTextToSpeechOnSilent || Settings.useTextToSpeechOnVibrate || Rule.isAnyRuleUsing(Action.Action_Enum.speakText))
|
if (Settings.useTextToSpeechOnNormal || Settings.useTextToSpeechOnSilent || Settings.useTextToSpeechOnVibrate || Rule.isAnyRuleUsing(Action.Action_Enum.speakText))
|
||||||
{
|
{
|
||||||
if (ttsEngine == null)
|
if (ttsEngine == null)
|
||||||
ttsEngine = new TextToSpeech(this, this);
|
{
|
||||||
} else
|
ttsEngine = new TextToSpeech(this, new TextToSpeech.OnInitListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onInit(int status)
|
||||||
|
{
|
||||||
|
ttsStatus = status;
|
||||||
|
|
||||||
|
if (status == TextToSpeech.SUCCESS)
|
||||||
|
{
|
||||||
|
ttsEngine.setLanguage(Locale.getDefault());
|
||||||
|
Miscellaneous.logEvent("i", "TTS engine", "TTS engine available.", 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Miscellaneous.logEvent("i", "TTS engine", "TTS engine not available. Status: " + String.valueOf(status), 3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (ttsEngine != null)
|
if (ttsEngine != null)
|
||||||
ttsEngine.shutdown();
|
ttsEngine.shutdown();
|
||||||
@ -673,25 +698,26 @@ public class AutomationService extends Service implements OnInitListener
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(int i = 0; i < 5; i++)
|
for(int i = 0; i < 60; i++)
|
||||||
{
|
{
|
||||||
if(ttsEngine != null)
|
if(ttsEngine == null || ttsStatus != TextToSpeech.SUCCESS)
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", "TTS", "Waiting for a moment to give the TTS service time to load...", 4);
|
Miscellaneous.logEvent("i", "TTS", "Waiting for a moment to give the TTS service time to load...", 4);
|
||||||
Thread.sleep(1000); // give the tts engine time to load
|
Thread.sleep(500); // give the tts engine time to load
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Miscellaneous.logEvent("i", "TextToSpeech", "Speaking \"" + text + "\" in language " + ttsEngine.getLanguage().toLanguageTag(), 3);
|
||||||
|
this.ttsEngine.speak(text, TextToSpeech.QUEUE_ADD, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Miscellaneous.logEvent("i", "TextToSpeech", "Speaking " + text + " in language " + ttsEngine.getLanguage().toLanguageTag(), 3);
|
Miscellaneous.logEvent("i", "TextToSpeech", "TTS engine not available after waiting 30 seconds, yet. Aborting.", 3);
|
||||||
this.ttsEngine.speak(text, TextToSpeech.QUEUE_ADD, null);
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
* Fixed: Now allowing negative integers as intent data
|
* Fixed: Now allowing negative integers as intent data
|
||||||
* Fixed: Multiple time frames with reoccurence configured would trigger to early executions
|
* Fixed: Multiple time frames with reoccurrence configured would trigger to early executions
|
||||||
* Fixed: Automatic app start at boot might fail in some cases
|
* Fixed: Automatic app start at boot might fail in some cases
|
||||||
* Translations updated
|
* Translations updated
|
2
fastlane/metadata/android/en-US/changelogs/126.txt
Normal file
2
fastlane/metadata/android/en-US/changelogs/126.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
* Fixed: TTS engine wouldn't always speak, especially at the startup of the app
|
||||||
|
* Added: Possibility to disable toasts for e.g. announcing rule activations
|
Loading…
Reference in New Issue
Block a user