Compare commits

..

3 Commits

Author SHA1 Message Date
Jens
27e9b3e0d1 New release 2023-02-09 23:24:29 +01:00
a6c6dfc6ba Bug fixed in TTS 2023-02-06 14:24:46 +01:00
Jens
6a7875cc61 Bugfix release 2023-02-01 23:29:26 +01:00
22 changed files with 95 additions and 20 deletions

View File

@ -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"
} }

View File

@ -476,6 +476,8 @@ public class Rule implements Comparable<Rule>
{ {
AutomationService service = AutomationService.getInstance(); AutomationService service = AutomationService.getInstance();
service.speak(messages[0], false); service.speak(messages[0], false);
if(Settings.showToasts)
Toast.makeText(service, messages[0], Toast.LENGTH_LONG).show(); Toast.makeText(service, messages[0], Toast.LENGTH_LONG).show();
super.onProgressUpdate(messages); super.onProgressUpdate(messages);

View File

@ -440,6 +440,8 @@ public class Rule implements Comparable<Rule>
{ {
AutomationService service = AutomationService.getInstance(); AutomationService service = AutomationService.getInstance();
service.speak(messages[0], false); service.speak(messages[0], false);
if(Settings.showToasts)
Toast.makeText(service, messages[0], Toast.LENGTH_LONG).show(); Toast.makeText(service, messages[0], Toast.LENGTH_LONG).show();
super.onProgressUpdate(messages); super.onProgressUpdate(messages);

View File

@ -467,6 +467,8 @@ public class Rule implements Comparable<Rule>
{ {
AutomationService service = AutomationService.getInstance(); AutomationService service = AutomationService.getInstance();
service.speak(messages[0], false); service.speak(messages[0], false);
if(Settings.showToasts)
Toast.makeText(service, messages[0], Toast.LENGTH_LONG).show(); Toast.makeText(service, messages[0], Toast.LENGTH_LONG).show();
super.onProgressUpdate(messages); super.onProgressUpdate(messages);

View File

@ -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;
@ -226,6 +233,7 @@ public class AutomationService extends Service implements OnInitListener
this.isRunning = true; this.isRunning = true;
Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.serviceStarted) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1); Miscellaneous.logEvent("i", "Service", this.getResources().getString(R.string.serviceStarted) + " VERSION_CODE: " + BuildConfig.VERSION_CODE + ", VERSION_NAME: " + BuildConfig.VERSION_NAME + ", flavor: " + BuildConfig.FLAVOR, 1);
if(Settings.showToasts)
Toast.makeText(this, this.getResources().getString(R.string.serviceStarted), Toast.LENGTH_LONG).show(); Toast.makeText(this, this.getResources().getString(R.string.serviceStarted), Toast.LENGTH_LONG).show();
/* /*
@ -306,6 +314,7 @@ public class AutomationService extends Service implements OnInitListener
stopRoutine(); stopRoutine();
this.isRunning = false; this.isRunning = false;
if(Settings.showToasts)
Toast.makeText(this, getResources().getString(R.string.serviceStopped), Toast.LENGTH_LONG).show(); Toast.makeText(this, getResources().getString(R.string.serviceStopped), Toast.LENGTH_LONG).show();
Miscellaneous.logEvent("i", "Service", getResources().getString(R.string.serviceStopped), 1); Miscellaneous.logEvent("i", "Service", getResources().getString(R.string.serviceStopped), 1);
} }
@ -315,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();
@ -671,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); {
Miscellaneous.logEvent("i", "TextToSpeech", "Speaking \"" + text + "\" in language " + ttsEngine.getLanguage().toLanguageTag(), 3);
this.ttsEngine.speak(text, TextToSpeech.QUEUE_ADD, null); this.ttsEngine.speak(text, TextToSpeech.QUEUE_ADD, null);
break;
}
}
Miscellaneous.logEvent("i", "TextToSpeech", "TTS engine not available after waiting 30 seconds, yet. Aborting.", 3);
} }
catch(Exception e) catch(Exception e)
{ {

View File

@ -65,6 +65,7 @@ public class Settings implements SharedPreferences
public static int tabsPlacement; public static int tabsPlacement;
public static boolean executeRulesAndProfilesWithSingleClick; public static boolean executeRulesAndProfilesWithSingleClick;
public static boolean displayNewsOnMainScreen; public static boolean displayNewsOnMainScreen;
public static boolean showToasts;
public static boolean automaticUpdateCheck; public static boolean automaticUpdateCheck;
public static long musicCheckFrequency; public static long musicCheckFrequency;
@ -130,6 +131,8 @@ public class Settings implements SharedPreferences
public static final int default_tabsPlacement = 0; public static final int default_tabsPlacement = 0;
public static final boolean default_executeRulesAndProfilesWithSingleClick = false; public static final boolean default_executeRulesAndProfilesWithSingleClick = false;
public static final boolean default_displayNewsOnMainScreen = false; public static final boolean default_displayNewsOnMainScreen = false;
public static final boolean default_showToasts = true;
public static final boolean default_automaticUpdateCheck = false; public static final boolean default_automaticUpdateCheck = false;
public static final boolean default_lockSoundChanges = false; public static final boolean default_lockSoundChanges = false;
public static final long default_lastNewsPolltime = -1; public static final long default_lastNewsPolltime = -1;
@ -277,6 +280,7 @@ public class Settings implements SharedPreferences
executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick); executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
automaticUpdateCheck = prefs.getBoolean("automaticUpdateCheck", default_automaticUpdateCheck); automaticUpdateCheck = prefs.getBoolean("automaticUpdateCheck", default_automaticUpdateCheck);
displayNewsOnMainScreen = prefs.getBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen); displayNewsOnMainScreen = prefs.getBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
showToasts = prefs.getBoolean("showToasts", default_showToasts);
lockSoundChanges = prefs.getBoolean("lockSoundChanges", default_lockSoundChanges); lockSoundChanges = prefs.getBoolean("lockSoundChanges", default_lockSoundChanges);
noticeAndroid9MicrophoneShown = prefs.getBoolean("noticeAndroid9MicrophoneShown", false); noticeAndroid9MicrophoneShown = prefs.getBoolean("noticeAndroid9MicrophoneShown", false);
@ -472,6 +476,9 @@ public class Settings implements SharedPreferences
if(!prefs.contains("displayNewsOnMainScreen") || force) if(!prefs.contains("displayNewsOnMainScreen") || force)
editor.putBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen); editor.putBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
if(!prefs.contains("showToasts") || force)
editor.putBoolean("showToasts", default_showToasts);
if(!prefs.contains("musicCheckFrequency") || force) if(!prefs.contains("musicCheckFrequency") || force)
editor.putLong("musicCheckFrequency", default_musicCheckFrequency); editor.putLong("musicCheckFrequency", default_musicCheckFrequency);
@ -555,6 +562,7 @@ public class Settings implements SharedPreferences
editor.putBoolean("executeRulesAndProfilesWithSingleClick", executeRulesAndProfilesWithSingleClick); editor.putBoolean("executeRulesAndProfilesWithSingleClick", executeRulesAndProfilesWithSingleClick);
editor.putBoolean("automaticUpdateCheck", automaticUpdateCheck); editor.putBoolean("automaticUpdateCheck", automaticUpdateCheck);
editor.putBoolean("displayNewsOnMainScreen", displayNewsOnMainScreen); editor.putBoolean("displayNewsOnMainScreen", displayNewsOnMainScreen);
editor.putBoolean("showToasts", showToasts);
if(Settings.musicCheckFrequency == 0) if(Settings.musicCheckFrequency == 0)
Settings.musicCheckFrequency = Settings.default_musicCheckFrequency; Settings.musicCheckFrequency = Settings.default_musicCheckFrequency;

View File

@ -74,6 +74,11 @@
android:title="@string/displayNewsOnMainScreen" android:title="@string/displayNewsOnMainScreen"
android:summary="@string/displayNewsOnMainScreenDescription" /> android:summary="@string/displayNewsOnMainScreenDescription" />
<CheckBoxPreference
android:key="showToasts"
android:title="@string/showToastsForEvents"
android:summary="@string/showToastsForEventsSummary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@ -777,4 +777,6 @@
<string name="attachment">Dateianhang</string> <string name="attachment">Dateianhang</string>
<string name="chooseFile">Datei wählen</string> <string name="chooseFile">Datei wählen</string>
<string name="startAppByStartService">via startService()</string> <string name="startAppByStartService">via startService()</string>
<string name="showToastsForEvents">Toasts anzeigen</string>
<string name="showToastsForEventsSummary">Popups anzeigen, wenn Ereignisse wie Regelausführungen auftreten</string>
</resources> </resources>

View File

@ -776,4 +776,6 @@
<string name="attachment">Archivo adjunto</string> <string name="attachment">Archivo adjunto</string>
<string name="chooseFile">elegir archivo</string> <string name="chooseFile">elegir archivo</string>
<string name="startAppByStartService">via startService()</string> <string name="startAppByStartService">via startService()</string>
<string name="showToastsForEvents">Mostrar toasts</string>
<string name="showToastsForEventsSummary">Mostrar notificaciones del sistema cuando se producen eventos como ejecuciones de reglas</string>
</resources> </resources>

View File

@ -776,4 +776,6 @@
<string name="attachment">Attachement</string> <string name="attachment">Attachement</string>
<string name="chooseFile">Choisissez un fichier</string> <string name="chooseFile">Choisissez un fichier</string>
<string name="startAppByStartService">via startService()</string> <string name="startAppByStartService">via startService()</string>
<string name="showToastsForEvents">Afficher les toasts</string>
<string name="showToastsForEventsSummary">Afficher les toasts lorsque des événements tels que des exécutions de règles se produisent</string>
</resources> </resources>

View File

@ -777,4 +777,6 @@
<string name="attachment">Allegato</string> <string name="attachment">Allegato</string>
<string name="chooseFile">Scegli file</string> <string name="chooseFile">Scegli file</string>
<string name="startAppByStartService">tramite startService()</string> <string name="startAppByStartService">tramite startService()</string>
<string name="showToastsForEvents">Mostra toast</string>
<string name="showToastsForEventsSummary">Mostrare gli avvisi popup quando si verificano eventi come le esecuzioni di regole</string>
</resources> </resources>

View File

@ -775,5 +775,7 @@
<string name="attachment">Bijlage</string> <string name="attachment">Bijlage</string>
<string name="chooseFile">kies bestand</string> <string name="chooseFile">kies bestand</string>
<string name="startAppByStartService">via startService()</string> <string name="startAppByStartService">via startService()</string>
<string name="showToastsForEvents">Toon toasts</string>
<string name="showToastsForEventsSummary">Pop-ups weergeven wanneer gebeurtenissen zoals regeluitvoeringen plaatsvinden</string>
</resources> </resources>

View File

@ -834,4 +834,6 @@
<string name="attachment">Прикрепление</string> <string name="attachment">Прикрепление</string>
<string name="chooseFile">выберите файл</string> <string name="chooseFile">выберите файл</string>
<string name="startAppByStartService">дорога startService()</string> <string name="startAppByStartService">дорога startService()</string>
<string name="showToastsForEvents">Показать тосты</string>
<string name="showToastsForEventsSummary">Отображение всплывающих уведомлений при таких событиях, как выполнение правил</string>
</resources> </resources>

View File

@ -874,4 +874,6 @@
<string name="attachment">Attachment</string> <string name="attachment">Attachment</string>
<string name="chooseFile">choose file</string> <string name="chooseFile">choose file</string>
<string name="startAppByStartService">by startService()</string> <string name="startAppByStartService">by startService()</string>
<string name="showToastsForEvents">Show toasts</string>
<string name="showToastsForEventsSummary">Show toasts when events like rule executions occur</string>
</resources> </resources>

View File

@ -0,0 +1,2 @@
* Behoben: Sprachausgabe hat nicht immer funktioniert, vor allem beim Programmstart
* Neu: Möglichkeit Toasts zu deaktivieren, z.B. für Regel-Aktivierungen

View File

@ -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

View 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

View File

@ -0,0 +1,2 @@
* Corregido: el motor TTS no siempre hablaba, especialmente al inicio de la aplicación
* Añadido: Posibilidad de desactivar las notificaciones del sistema para, por ejemplo, anunciar activaciones de reglas

View File

@ -0,0 +1,2 @@
* Correction : le moteur TTS ne parlait pas toujours, surtout au démarrage de l'application
* Ajouté: Possibilité de désactiver les toasts pour, par exemple, annoncer les activations de règles

View File

@ -0,0 +1,2 @@
* Risolto: il motore TTS non parlava sempre, specialmente all'avvio dell'app
* Aggiunto: Possibilità di disabilitare gli avvisi popup ad esempio per annunciare l'attivazione delle regole

View File

@ -0,0 +1,2 @@
* Opgelost: TTS-engine zou niet altijd spreken, vooral bij het opstarten van de app
* Toegevoegd: Mogelijkheid om toasts uit te schakelen voor bijvoorbeeld het aankondigen van regelactiveringen

View File

@ -0,0 +1,2 @@
* Исправлено: движок TTS не всегда говорил, особенно при запуске приложения
* Добавлено: Возможность отключения всплывающих уведомлений, например, для объявления активации правил