fix in DateTimeTrigger management and executions when service already stopped

This commit is contained in:
jens 2022-04-03 20:25:10 +02:00
parent 0d3a13e753
commit 391edc59bf
2 changed files with 15 additions and 6 deletions

View File

@ -233,20 +233,24 @@ public class Rule implements Comparable<Rule>
} }
if(!changeExistingRule) if(!changeExistingRule)
for(Rule rule : Rule.ruleCollection) {
if(rule.getName().equals(this.getName())) for (Rule rule : Rule.ruleCollection)
{
if (rule.getName().equals(this.getName()))
{ {
Toast.makeText(context, context.getResources().getString(R.string.anotherRuleByThatName), Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.anotherRuleByThatName), Toast.LENGTH_LONG).show();
return false; return false;
} }
}
if(this.getTriggerSet().size()==0) }
if(this.getTriggerSet().size() == 0)
{ {
Toast.makeText(context, context.getResources().getString(R.string.pleaseSpecifiyTrigger), Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.pleaseSpecifiyTrigger), Toast.LENGTH_LONG).show();
return false; return false;
} }
if(this.getActionSet().size()==0) if(this.getActionSet().size() == 0)
{ {
Toast.makeText(context, context.getResources().getString(R.string.pleaseSpecifiyAction), Toast.LENGTH_LONG).show(); Toast.makeText(context, context.getResources().getString(R.string.pleaseSpecifiyAction), Toast.LENGTH_LONG).show();
return false; return false;

View File

@ -70,7 +70,7 @@ public class ActivityManageRule extends Activity
static int triggerBattery; static int triggerBattery;
static double triggerSpeed; static double triggerSpeed;
static double triggerNoise; static double triggerNoise;
static Rule ruleToEdit; static Rule ruleToEdit;
static boolean newRule; static boolean newRule;
@ -225,6 +225,11 @@ public class ActivityManageRule extends Activity
loadFormValuesToVariable(); loadFormValuesToVariable();
if(ruleToEdit.change(context)) if(ruleToEdit.change(context))
{ {
for(Rule r : Rule.ruleCollection)
{
r.get
}
ActivityPermissions.getRequiredPermissions(false); ActivityPermissions.getRequiredPermissions(false);
finish(); finish();
} }