From 1c24af7bcbe8f5fca7bac9bccba4ac0d5b48352c Mon Sep 17 00:00:00 2001 From: jens Date: Sun, 11 Apr 2021 19:37:50 +0200 Subject: [PATCH] StartAppChanges --- .../apkFlavor/java/com/jens/automation2/Rule.java | 4 ++-- .../fdroidFlavor/java/com/jens/automation2/Rule.java | 4 ++-- .../java/com/jens/automation2/Rule.java | 4 ++-- .../com/jens/automation2/ReceiverCoordinator.java | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/apkFlavor/java/com/jens/automation2/Rule.java b/app/src/apkFlavor/java/com/jens/automation2/Rule.java index ab5baa87..03f2da0d 100644 --- a/app/src/apkFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/apkFlavor/java/com/jens/automation2/Rule.java @@ -490,7 +490,7 @@ public class Rule implements Comparable { if(oneTrigger.getTriggerParameter()) { - if(BatteryReceiver.getBatteryLevel() < oneTrigger.getBatteryLevel()) + if(BatteryReceiver.getBatteryLevel() <= oneTrigger.getBatteryLevel()) { Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); return false; @@ -498,7 +498,7 @@ public class Rule implements Comparable } else { - if(BatteryReceiver.getBatteryLevel() > oneTrigger.getBatteryLevel()) + if(oneTrigger.getBatteryLevel() >= oneTrigger.getBatteryLevel()) { Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); return false; diff --git a/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java b/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java index 612b84f0..4d94fd72 100644 --- a/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/fdroidFlavor/java/com/jens/automation2/Rule.java @@ -484,7 +484,7 @@ public class Rule implements Comparable { if(oneTrigger.getTriggerParameter()) { - if(BatteryReceiver.getBatteryLevel() < oneTrigger.getBatteryLevel()) + if(BatteryReceiver.getBatteryLevel() <= oneTrigger.getBatteryLevel()) { Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); return false; @@ -492,7 +492,7 @@ public class Rule implements Comparable } else { - if(BatteryReceiver.getBatteryLevel() > oneTrigger.getBatteryLevel()) + if(oneTrigger.getBatteryLevel() >= oneTrigger.getBatteryLevel()) { Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); return false; diff --git a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java index 2ce81225..ae9a33f8 100644 --- a/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java +++ b/app/src/googlePlayFlavor/java/com/jens/automation2/Rule.java @@ -486,7 +486,7 @@ public class Rule implements Comparable { if(oneTrigger.getTriggerParameter()) { - if(BatteryReceiver.getBatteryLevel() < oneTrigger.getBatteryLevel()) + if(BatteryReceiver.getBatteryLevel() <= oneTrigger.getBatteryLevel()) { Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); return false; @@ -494,7 +494,7 @@ public class Rule implements Comparable } else { - if(BatteryReceiver.getBatteryLevel() > oneTrigger.getBatteryLevel()) + if(oneTrigger.getBatteryLevel() >= oneTrigger.getBatteryLevel()) { Miscellaneous.logEvent("i", String.format(context.getResources().getString(R.string.ruleCheckOf), this.getName()), context.getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(oneTrigger.getBatteryLevel()), 3); return false; diff --git a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java index b53f37c4..9bdd4a20 100644 --- a/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java +++ b/app/src/main/java/com/jens/automation2/ReceiverCoordinator.java @@ -273,24 +273,24 @@ public class ReceiverCoordinator if(Rule.isAnyRuleUsing(Trigger.Trigger_Enum.activityDetection)) { - Object runResult = Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "isActivityDetectionReceiverRunning", null);; + Object runResult = Miscellaneous.runMethodReflective(activityDetectionClassPath, "isActivityDetectionReceiverRunning", null);; if(runResult instanceof Boolean) { boolean isRunning = (Boolean) runResult; if (isRunning) { Miscellaneous.logEvent("i", "LocationProvider", "Restarting ActivityDetectionReceiver because used in a new/changed rule.", 4); - boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null); + boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective(activityDetectionClassPath, "haveAllPermission", null); if (haveAllPerms) - Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "restartActivityDetectionReceiver", null); + Miscellaneous.runMethodReflective(activityDetectionClassPath, "restartActivityDetectionReceiver", null); // ActivityDetectionReceiver.restartActivityDetectionReceiver(); } else { Miscellaneous.logEvent("i", "LocationProvider", "Starting ActivityDetectionReceiver because used in a new/changed rule.", 4); - boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "haveAllPermission", null); + boolean haveAllPerms = (Boolean) Miscellaneous.runMethodReflective(activityDetectionClassPath, "haveAllPermission", null); if (haveAllPerms) - Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "startActivityDetectionReceiver", null); + Miscellaneous.runMethodReflective(activityDetectionClassPath, "startActivityDetectionReceiver", null); // ActivityDetectionReceiver.startActivityDetectionReceiver(); } } @@ -304,7 +304,7 @@ public class ReceiverCoordinator if (isRunning) { Miscellaneous.logEvent("i", "LocationProvider", "Shutting down ActivityDetectionReceiver because not used in any rule.", 4); - Miscellaneous.runMethodReflective("ActivityDetectionReceiver", "stopActivityDetectionReceiver", null); + Miscellaneous.runMethodReflective(activityDetectionClassPath, "stopActivityDetectionReceiver", null); // ActivityDetectionReceiver.stopActivityDetectionReceiver(); } }