forked from jens/Automation
battery level trigger fixed
This commit is contained in:
parent
53e62068a5
commit
eeb4f4a39e
@ -884,6 +884,7 @@ public class ActivityManageRule extends Activity
|
|||||||
|
|
||||||
return alertDialog;
|
return alertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AlertDialog getTriggerBatteryDialog(final Context myContext, final String[] choices)
|
private AlertDialog getTriggerBatteryDialog(final Context myContext, final String[] choices)
|
||||||
{
|
{
|
||||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
|
||||||
@ -898,6 +899,7 @@ public class ActivityManageRule extends Activity
|
|||||||
triggerBattery = (which+1);
|
triggerBattery = (which+1);
|
||||||
newTrigger.setTriggerType(Trigger_Enum.batteryLevel);
|
newTrigger.setTriggerType(Trigger_Enum.batteryLevel);
|
||||||
newTrigger.setBatteryLevel(triggerBattery);
|
newTrigger.setBatteryLevel(triggerBattery);
|
||||||
|
newTrigger.setTriggerParameter2(String.valueOf(triggerBattery));
|
||||||
// Log.i("test", newTrigger.toString());
|
// Log.i("test", newTrigger.toString());
|
||||||
// Log.i("test", String.valueOf(newTrigger.getBatteryLevel()));
|
// Log.i("test", String.valueOf(newTrigger.getBatteryLevel()));
|
||||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||||
|
@ -794,9 +794,15 @@ public class Trigger
|
|||||||
|
|
||||||
boolean checkBatteryLevel()
|
boolean checkBatteryLevel()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
-1 means value is not known, yet.
|
||||||
|
*/
|
||||||
|
if(BatteryReceiver.getBatteryLevel() == -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(this.getTriggerParameter())
|
if(this.getTriggerParameter())
|
||||||
{
|
{
|
||||||
if(BatteryReceiver.getBatteryLevel() <= this.getBatteryLevel())
|
if(BatteryReceiver.getBatteryLevel() < this.getBatteryLevel())
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(this.getBatteryLevel()), this.getParentRule().getName()), 3);
|
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyBatteryLowerThan) + " " + String.valueOf(this.getBatteryLevel()), this.getParentRule().getName()), 3);
|
||||||
return false;
|
return false;
|
||||||
@ -804,7 +810,7 @@ public class Trigger
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(this.getBatteryLevel() >= this.getBatteryLevel())
|
if(BatteryReceiver.getBatteryLevel() >= this.getBatteryLevel())
|
||||||
{
|
{
|
||||||
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(this.getBatteryLevel()), this.getParentRule().getName()), 3);
|
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyBatteryHigherThan) + " " + String.valueOf(this.getBatteryLevel()), this.getParentRule().getName()), 3);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
* New action: Keep phone turned on
|
* New action: Keep phone turned on
|
||||||
* New: Regular expressions enabled where comparisons apply (one has to use "equals")
|
* New: Regular expressions enabled where comparisons apply (one has to use "equals")
|
||||||
* Fixed: Changed input type for decimal numbers when adding intent data
|
* Fixed: Changed input type for decimal numbers when adding intent data
|
||||||
|
* Fixed: Battery level trigger not working when using direction falling-below
|
Loading…
Reference in New Issue
Block a user