From 6a7875cc612704ada66be5c5d6ebf9316333970a Mon Sep 17 00:00:00 2001 From: Jens Date: Wed, 1 Feb 2023 23:29:26 +0100 Subject: [PATCH] Bugfix release --- app/src/apkFlavor/java/com/jens/automation2/Rule.java | 4 +++- app/src/fdroidFlavor/java/com/jens/automation2/Rule.java | 4 +++- .../googlePlayFlavor/java/com/jens/automation2/Rule.java | 4 +++- .../main/java/com/jens/automation2/AutomationService.java | 6 ++++-- app/src/main/java/com/jens/automation2/Settings.java | 8 ++++++++ app/src/main/res/layout/activity_settings.xml | 7 ++++++- app/src/main/res/values/strings.xml | 2 ++ 7 files changed, 29 insertions(+), 6 deletions(-) diff --git a/app/src/apkFlavor/java/com/jens/automation2/Rule.java b/app/src/apkFlavor/java/com/jens/automation2/Rule.java index d92a0f96..cfb62041 100644 --- a/app/src/apkFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/apkFlavor/java/com/jens/automation2/Rule.java @@ -476,7 +476,9 @@ public class Rule implements Comparable { 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); } diff --git a/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java b/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java index d83f5e9c..c28d3661 100644 --- a/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java @@ -440,7 +440,9 @@ public class Rule implements Comparable { 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); } diff --git a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java index 94649876..5ae17ff4 100644 --- a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java @@ -467,7 +467,9 @@ public class Rule implements Comparable { 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); } diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java index 6429c2aa..5d754dfb 100644 --- a/app/src/main/java/com/jens/automation2/AutomationService.java +++ b/app/src/main/java/com/jens/automation2/AutomationService.java @@ -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); } diff --git a/app/src/main/java/com/jens/automation2/Settings.java b/app/src/main/java/com/jens/automation2/Settings.java index 1a3936cf..895a81b9 100644 --- a/app/src/main/java/com/jens/automation2/Settings.java +++ b/app/src/main/java/com/jens/automation2/Settings.java @@ -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; diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 400ecaff..5eec7a1b 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -74,7 +74,12 @@ android:title="@string/displayNewsOnMainScreen" android:summary="@string/displayNewsOnMainScreenDescription" /> - + + + Attachment choose file by startService() + Show toasts + Show toasts when events like rule executions occur \ No newline at end of file