diff --git a/app/src/apkFlavor/java/com/jens/automation2/Rule.java b/app/src/apkFlavor/java/com/jens/automation2/Rule.java index 8112d2d..4af1dd0 100644 --- a/app/src/apkFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/apkFlavor/java/com/jens/automation2/Rule.java @@ -376,19 +376,19 @@ public class Rule implements Comparable { if(hasNotAppliedSinceLastExecution()) { - Miscellaneous.logEvent("i", "getsGreenLight()", "Rule " + getName() + " applies and has flipped since its last execution.", 4); + Miscellaneous.logEvent("i", "getsGreenLight()", "Rule \"" + getName() + "\" applies and has flipped since its last execution.", 4); return true; } else if(hasTriggerOfType(Trigger.Trigger_Enum.calendarEvent) && CalendarReceiver.mayRuleStillBeActivatedForPendingCalendarEvents(this)) { - Miscellaneous.logEvent("i", "getsGreenLight()", "Rule " + getName() + " applies, has not flipped since its last execution, but may still be executed for other calendar events.", 4); + Miscellaneous.logEvent("i", "getsGreenLight()", "Rule \"" + getName() + "\" applies, has not flipped since its last execution, but may still be executed for other calendar events.", 4); return true; } else - Miscellaneous.logEvent("i", "getsGreenLight()", "Rule " + getName() + " has not flipped since its last execution.", 4); + Miscellaneous.logEvent("i", "getsGreenLight()", "Rule \"" + getName() + "\" has not flipped since its last execution.", 4); } else - Miscellaneous.logEvent("i", "getsGreenLight()", "Rule " + getName() + " does not apply.", 4); + Miscellaneous.logEvent("i", "getsGreenLight()", "Rule \"" + getName() + "\" does not apply.", 4); return false; } @@ -397,7 +397,7 @@ public class Rule implements Comparable { if(AutomationService.getInstance() == null) { - Miscellaneous.logEvent("i", "RuleCheck", "Automation service not running. Rule " + getName() + " cannot apply.", 3); + Miscellaneous.logEvent("i", "RuleCheck", "Automation service not running. Rule \"" + getName() + "\" cannot apply.", 3); return false; } @@ -409,7 +409,7 @@ public class Rule implements Comparable return false; } - Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule %1$s generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3); + Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule \"%1$s\" generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3); return true; } diff --git a/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java b/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java index 822d943..d6cfddb 100644 --- a/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java @@ -403,7 +403,7 @@ public class Rule implements Comparable return false; } - Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule %1$s generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3); + Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule \"%1$s\" generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3); return true; } diff --git a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java index 012b4b4..3d92ab2 100644 --- a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java @@ -406,7 +406,7 @@ public class Rule implements Comparable return false; } - Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule %1$s generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3); + Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), String.format("Rule \"%1$s\" generally applies currently. Checking if it's really due, yet will be done separately.", this.getName()), 3); return true; } diff --git a/app/src/main/java/com/jens/automation2/Trigger.java b/app/src/main/java/com/jens/automation2/Trigger.java index e6bd87a..078d550 100644 --- a/app/src/main/java/com/jens/automation2/Trigger.java +++ b/app/src/main/java/com/jens/automation2/Trigger.java @@ -695,7 +695,7 @@ public class Trigger boolean isActive = getTriggerParameter(); if (!ignoreActive && isActive != event.isCurrentlyActive()) { - Miscellaneous.logEvent("i", "CalendarCheck", "Event has to be currently active: " + String.valueOf(triggerParameter) + ", but is required otherwise.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Event " + event.title + " has to be currently active: " + String.valueOf(triggerParameter) + ", but is required otherwise.", 5); return false; } @@ -703,7 +703,7 @@ public class Trigger { if (!Miscellaneous.compare(conditions[0], conditions[1], event.title)) { - Miscellaneous.logEvent("i", "CalendarCheck", "Title does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Title of event " + event.title + " does not match.", 5); return false; } } @@ -712,7 +712,7 @@ public class Trigger { if (!Miscellaneous.compare(conditions[2], conditions[3], event.description)) { - Miscellaneous.logEvent("i", "CalendarCheck", "Description does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Description " + event.title + " does not match.", 5); return false; } } @@ -721,7 +721,7 @@ public class Trigger { if (!Miscellaneous.compare(conditions[4], conditions[5], event.location)) { - Miscellaneous.logEvent("i", "CalendarCheck", "Location does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Location " + event.title + " does not match.", 5); return false; } } @@ -730,7 +730,7 @@ public class Trigger { if (Boolean.parseBoolean(conditions[7]) != event.allDay) { - Miscellaneous.logEvent("i", "CalendarCheck", "All day setting does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "All day setting " + event.title + " does not match.", 5); return false; } } @@ -739,7 +739,7 @@ public class Trigger { if (Boolean.parseBoolean(conditions[9]) != event.reoccurring) { - Miscellaneous.logEvent("i", "CalendarCheck", "Reoccurring setting does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Reoccurring setting " + event.title + " does not match.", 5); return false; } } @@ -751,7 +751,7 @@ public class Trigger { if (!Miscellaneous.arraySearch(availabilities, event.availability, false, true)) { - Miscellaneous.logEvent("i", "CalendarCheck", "Availability does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Availability of event " + event.title + " does not match.", 5); return false; } } @@ -764,7 +764,7 @@ public class Trigger { if (!Miscellaneous.arraySearch(calendars, String.valueOf(event.calendarId), false, true)) { - Miscellaneous.logEvent("i", "CalendarCheck", "Calendar does not match.", 5); + Miscellaneous.logEvent("i", "CalendarCheck", "Calendar of event " + event.title + " does not match.", 5); return false; } } @@ -1115,13 +1115,13 @@ public class Trigger { if(!this.getTriggerParameter()) { - Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule %1$s doesn't apply. We're entering POI: " + this.getPointOfInterest().getName() + ", not leaving it.", getParentRule().getName()), 4); + Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule \"%1$s\" doesn't apply. We're entering POI: " + this.getPointOfInterest().getName() + ", not leaving it.", getParentRule().getName()), 4); return false; } } else { - Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule %1$s doesn't apply. This is " + activePoi.getName() + ", not " + this.getPointOfInterest().getName() + ".", getParentRule().getName()), 4); + Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule \"%1$s\" doesn't apply. This is " + activePoi.getName() + ", not " + this.getPointOfInterest().getName() + ".", getParentRule().getName()), 4); return false; } } @@ -1147,7 +1147,7 @@ public class Trigger } else { - Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule %1$s doesn't apply. We're not at POI \"" + this.getPointOfInterest().getName() + "\".", getParentRule().getName()), 3); + Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule \"%1$s\" doesn't apply. We're not at POI \"" + this.getPointOfInterest().getName() + "\".", getParentRule().getName()), 3); return false; } // } @@ -1156,7 +1156,7 @@ public class Trigger { if(!this.getTriggerParameter()) { - Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule %1$s doesn't apply. We're at no POI. Rule specifies to be at anyone.", getParentRule().getName()), 5); + Miscellaneous.logEvent("i", String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), this.getParentRule().getName()), String.format("Rule \"%1$s\" doesn't apply. We're at no POI. Rule specifies to be at anyone.", getParentRule().getName()), 5); return false; } } diff --git a/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java b/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java index 50f777b..ef0064e 100644 --- a/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java +++ b/app/src/main/java/com/jens/automation2/receivers/CalendarReceiver.java @@ -90,9 +90,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis { Miscellaneous.logEvent("i", "CalendarReceiver", "Clearing calendar caches.", 4); - calendarsCache = null; - calendarEventsCache = null; - calendarEventsReoccurringCache = null; + clearCaches(); routineAtAlarm(); } @@ -118,6 +116,13 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis startCalendarReceiver(automationServiceRef); } + static void clearCaches() + { + calendarsCache = null; + calendarEventsCache = null; + calendarEventsReoccurringCache = null; + } + @Override public void stopListener(AutomationService automationService) { @@ -129,9 +134,7 @@ public class CalendarReceiver extends BroadcastReceiver implements AutomationLis calendarReceiverInstance = null; } - calendarsCache = null; - calendarEventsCache = null; - calendarEventsReoccurringCache = null; + clearCaches(); calendarReceiverActive = false; } diff --git a/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java b/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java index be4079a..48d05c0 100644 --- a/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java +++ b/app/src/main/java/com/jens/automation2/receivers/DateTimeListener.java @@ -304,7 +304,7 @@ public class DateTimeListener extends BroadcastReceiver implements AutomationLis { Miscellaneous.logEvent("i", "AlarmListener", "Stopping alarm listener.", 4); clearAlarms(); - centralAlarmManagerInstance.cancel(alarmPendingIntent); +// centralAlarmManagerInstance.cancel(alarmPendingIntent); alarmListenerActive = false; } else diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index cd5b314..dbfb758 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -212,16 +212,16 @@ Nazwa WiFi Wprowadź nazwę Wi-Fi. Pozostaw puste dla dowolnej sieci Wi-Fi. Anuluj - Rule %1$s doesn\'t apply. We are slower than - Rule %1$s doesn\'t apply. We are faster than - Rule %1$s doesn\'t apply. It\'s quieter than - Rule %1$s doesn\'t apply. It\'s louder than - Rule %1$s doesn\'t apply. Battery level is lower than - Rule %1$s doesn\'t apply. Battery level is higher than - Rule %1$s doesn\'t apply. Not the correct SSID (demanded: \"%2$s\", given: \"%3$s\"). - Rule %1$s doesn\'t apply. There is no tag label or not tag at all. - Rule %1$s doesn\'t apply. Wrong tag label. - Rule %1$s is deactivated, can\'t apply. + Rule \"%1$s\" doesn\'t apply. We are slower than + Rule \"%1$s\" doesn\'t apply. We are faster than + Rule \"%1$s\" doesn\'t apply. It\'s quieter than + Rule \"%1$s\" doesn\'t apply. It\'s louder than + Rule \"%1$s\" doesn\'t apply. Battery level is lower than + Rule \"%1$s\" doesn\'t apply. Battery level is higher than + Rule \"%1$s\" doesn\'t apply. Not the correct SSID (demanded: \"%2$s\", given: \"%3$s\"). + Rule \"%1$s\" doesn\'t apply. There is no tag label or not tag at all. + Rule \"%1$s\" doesn\'t apply. Wrong tag label. + Rule \"%1$s\" is deactivated, can\'t apply. uruchamianie wyłączanie łączenie @@ -383,8 +383,8 @@ przełącznik Wykryto nakładanie się do lokalizacji %1$s z %2$s metrów. Zmniejsz promień przynajmniej o tyle. No overlap to other locations detected. - Rule %1$s is toggable. - Rule %1$s is not suitable for toggling. + Rule \"%1$s\" is toggable. + Rule \"%1$s\" is not suitable for toggling. nic dowolna lokalizacjan Błędna nazwadla lokalizacji. @@ -405,8 +405,8 @@ Spacer Bieganie Nieprawidłowa aktywność - Rule %1$s doesn\'t apply. Detected activity %2$s given, but too low probability (%3$s %%), required %4$s %%. - Rule %1$s doesn\'t apply. Required activity %2$s not present. + Rule \"%1$s\" doesn\'t apply. Detected activity %2$s given, but too low probability (%3$s %%), required %4$s %%. + Rule \"%1$s\" doesn\'t apply. Required activity %2$s not present. Wybierz rodzaj aktywności Ten wyzwalacz jest dostępny tylko wtedy, gdy są zainstalowane Usługi Google Play. Częstotliwość wykrywania aktywności [sec] @@ -426,8 +426,8 @@ Bluetooth device %1$s in range. Urządzenie Bluetooth %1$s w zasięgu. dowolne urządzenie - Rule %1$s doesn\'t apply. Not the correct bluetooth device name. - Rule %1$s doesn\'t apply. Not the correct bluetooth device address. + Rule \"%1$s\" doesn\'t apply. Not the correct bluetooth device name. + Rule \"%1$s\" doesn\'t apply. Not the correct bluetooth device address. bez urządzenia jedne z listy połączenie z urządzeniem @@ -436,8 +436,8 @@ urządzenie poza zasięgiem Wybierz opcję urządzenia. Wybierz opcję połączenia. - Rule %1$s doesn\'t apply. Device is in range, but should not be. - Rule %1$s doesn\'t apply. Wrong state. + Rule \"%1$s\" doesn\'t apply. Device is in range, but should not be. + Rule \"%1$s\" doesn\'t apply. Wrong state. Połączenie zestawu słuchawkowego Otwórz odtwarzacz muzyki Zestaw słuchawkowy (typ: %1$s) podłączony @@ -446,7 +446,7 @@ Mikrofon Albo Wybierz typ słuchawek - Rule %1$s doesn\'t apply. Wrong headphone type. + Rule \"%1$s\" doesn\'t apply. Wrong headphone type. Ignoring activity detection update. Came in sooner that %1$s seconds. Co to jest? At least rule \"%1$s\" is using a trigger of type \"%2$s\". diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 108a345..8029fac 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,9 +1,9 @@ Automation - Activating rule %1$s + Activating Rule \"%1$s\" Activating profile %1$s - Activating rule %1$s in Togglemode + Activating Rule \"%1$s\" in Togglemode Add location Add Rule Location List: @@ -212,16 +212,16 @@ Wifi name Enter a wifi name. Leave empty for any wifi. Cancel - Rule %1$s doesn\'t apply. We are slower than - Rule %1$s doesn\'t apply. We are faster than - Rule %1$s doesn\'t apply. It\'s quieter than - Rule %1$s doesn\'t apply. It\'s louder than - Rule %1$s doesn\'t apply. Battery level is lower than - Rule %1$s doesn\'t apply. Battery level is higher than - Rule %1$s doesn\'t apply. Not the correct SSID (demanded: \"%2$s\", given: \"%3$s\"). - Rule %1$s doesn\'t apply. There is no tag label or not tag at all. - Rule %1$s doesn\'t apply. Wrong tag label. - Rule %1$s is deactivated, can\'t apply. + Rule \"%1$s\" doesn\'t apply. We are slower than + Rule \"%1$s\" doesn\'t apply. We are faster than + Rule \"%1$s\" doesn\'t apply. It\'s quieter than + Rule \"%1$s\" doesn\'t apply. It\'s louder than + Rule \"%1$s\" doesn\'t apply. Battery level is lower than + Rule \"%1$s\" doesn\'t apply. Battery level is higher than + Rule \"%1$s\" doesn\'t apply. Not the correct SSID (demanded: \"%2$s\", given: \"%3$s\"). + Rule \"%1$s\" doesn\'t apply. There is no tag label or not tag at all. + Rule \"%1$s\" doesn\'t apply. Wrong tag label. + Rule \"%1$s\" is deactivated, can\'t apply. starting stopping connecting @@ -308,7 +308,7 @@ Wifi name specified, checking that. Wifi name matches. Rule will apply. No wifi name specified, any will do. - RuleCheck of %1$s + RuleCheck of \"%1$s\" Airplane mode Activate Deactivate @@ -383,8 +383,8 @@ toggle Overlap detected to location %1$s of %2$s meters. Reduce radius by at least that. No overlap to other locations detected. - Rule %1$s is toggable. - Rule %1$s is not suitable for toggling. + Rule \"%1$s\" is toggable. + Rule \"%1$s\" is not suitable for toggling. none any location Invalid name for location. @@ -405,8 +405,8 @@ Walking Running Invalid activity - Rule %1$s doesn\'t apply. Detected activity %2$s given, but too low probability (%3$s %%), required %4$s %%. - Rule %1$s doesn\'t apply. Required activity %2$s not present. + Rule \"%1$s\" doesn\'t apply. Detected activity %2$s given, but too low probability (%3$s %%), required %4$s %%. + Rule \"%1$s\" doesn\'t apply. Required activity %2$s not present. Select type of activity This trigger is only available if Google Play Services is installed. Activity detection frequency [sec] @@ -426,8 +426,8 @@ Bluetooth device %1$s in range. Bluetooth device %1$s out of range. any device - Rule %1$s doesn\'t apply. Not the correct bluetooth device name. - Rule %1$s doesn\'t apply. Not the correct bluetooth device address. + Rule \"%1$s\" doesn\'t apply. Not the correct bluetooth device name. + Rule \"%1$s\" doesn\'t apply. Not the correct bluetooth device address. no device one from list connection to device @@ -436,8 +436,8 @@ device out of range Select a device option. Select a connection option. - Rule %1$s doesn\'t apply. Device is in range, but should not be. - Rule %1$s doesn\'t apply. Wrong state. + Rule \"%1$s\" doesn\'t apply. Device is in range, but should not be. + Rule \"%1$s\" doesn\'t apply. Wrong state. Headset connection Open music player Headset (type: %1$s) connected @@ -446,7 +446,7 @@ Microphone Either Select type of headphone - Rule %1$s doesn\'t apply. Wrong headphone type. + Rule \"%1$s\" doesn\'t apply. Wrong headphone type. Ignoring activity detection update. Came in sooner that %1$s seconds. What\'s this? At least rule \"%1$s\" is using a trigger of type \"%2$s\". @@ -746,7 +746,7 @@ profile %1$s is active profile %1$s is not active If this checkbox is not disabled, it will only be checked if the selected profile has been the last one to be activated. It doesn\'t matter if any audio related settings have been changed externally. However if the checkbox is enabled, the current audio settings really need to be like defined in the profile. BEWARE: Checking the ringtone file is currently not supported, yet. - Cannot delete this profile. Rule %1$s is referencing profile %2$s. + Cannot delete this profile. Rule \"%1$s\" is referencing profile %2$s. Profile could not be deleted. no repetition using authentication