Bugfix release

This commit is contained in:
Jens 2023-02-01 23:29:26 +01:00
parent 6f80caa1c6
commit 6a7875cc61
7 changed files with 29 additions and 6 deletions

View File

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

View File

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

View File

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

View File

@ -226,7 +226,8 @@ public class AutomationService extends Service implements OnInitListener
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);
Toast.makeText(this, this.getResources().getString(R.string.serviceStarted), Toast.LENGTH_LONG).show();
if(Settings.showToasts)
Toast.makeText(this, this.getResources().getString(R.string.serviceStarted), Toast.LENGTH_LONG).show();
/*
On normal phones the app is supposed to automatically restart in case of any problems.
@ -306,7 +307,8 @@ public class AutomationService extends Service implements OnInitListener
stopRoutine();
this.isRunning = false;
Toast.makeText(this, getResources().getString(R.string.serviceStopped), Toast.LENGTH_LONG).show();
if(Settings.showToasts)
Toast.makeText(this, getResources().getString(R.string.serviceStopped), Toast.LENGTH_LONG).show();
Miscellaneous.logEvent("i", "Service", getResources().getString(R.string.serviceStopped), 1);
}

View File

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

View File

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

View File

@ -874,4 +874,6 @@
<string name="attachment">Attachment</string>
<string name="chooseFile">choose file</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>