From 04fe674cf6242b662d06124a41e320c196cafc49 Mon Sep 17 00:00:00 2001 From: jens Date: Thu, 25 Jan 2024 14:03:39 +0100 Subject: [PATCH] Battery charging type differentiation --- app/src/apkFlavor/AndroidManifest.xml | 2 +- app/src/fdroidFlavor/AndroidManifest.xml | 1 + app/src/googlePlayFlavor/AndroidManifest.xml | 1 + .../jens/automation2/ActivityManageRule.java | 44 ++++++- .../ActivityManageTriggerCharging.java | 87 +++++++++++++ .../java/com/jens/automation2/Trigger.java | 43 ++++-- .../receivers/BatteryReceiver.java | 37 +++--- .../activity_manage_trigger_charging.xml | 123 ++++++++++++++++++ app/src/main/res/values-de/strings.xml | 5 + app/src/main/res/values-es/strings.xml | 5 + app/src/main/res/values-fr/strings.xml | 5 + app/src/main/res/values-it/strings.xml | 5 + app/src/main/res/values-nl/strings.xml | 5 + app/src/main/res/values-pl/strings.xml | 5 + app/src/main/res/values-ru/strings.xml | 5 + app/src/main/res/values-zh-rCN/strings.xml | 5 + app/src/main/res/values/strings.xml | 5 + .../metadata/android/en-US/changelogs/138.txt | 3 +- 18 files changed, 357 insertions(+), 29 deletions(-) create mode 100644 app/src/main/java/com/jens/automation2/ActivityManageTriggerCharging.java create mode 100644 app/src/main/res/layout/activity_manage_trigger_charging.xml diff --git a/app/src/apkFlavor/AndroidManifest.xml b/app/src/apkFlavor/AndroidManifest.xml index baa18f9..d1f8b47 100644 --- a/app/src/apkFlavor/AndroidManifest.xml +++ b/app/src/apkFlavor/AndroidManifest.xml @@ -233,7 +233,6 @@ - @@ -242,6 +241,7 @@ + + + ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.charging); -// ArrayList ruleCandidates = Rule.findRuleCandidatesByCharging(true); for(int i=0; i ruleCandidates = Rule.findRuleCandidates(Trigger_Enum.usb_host_connection); -// ArrayList ruleCandidates = Rule.findRuleCandidatesByUsbHost(true); for(Rule oneRule : ruleCandidates) { if(oneRule.getsGreenLight(context)) oneRule.activate(automationServiceRef, false); } - this.actionCharging(context); + this.actionCharging(context, BatteryManager.BATTERY_PLUGGED_USB); } } diff --git a/app/src/main/res/layout/activity_manage_trigger_charging.xml b/app/src/main/res/layout/activity_manage_trigger_charging.xml new file mode 100644 index 0000000..cc95409 --- /dev/null +++ b/app/src/main/res/layout/activity_manage_trigger_charging.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +