profile trigger

This commit is contained in:
2022-01-05 18:06:26 +01:00
parent 5653a9c70e
commit 941bb3e1af
18 changed files with 313 additions and 82 deletions

View File

@ -12,7 +12,6 @@ import android.widget.Toast;
import com.google.android.gms.location.DetectedActivity;
import com.jens.automation2.receivers.ActivityDetectionReceiver;
import java.sql.Time;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
@ -834,8 +833,32 @@ public class Rule implements Comparable<Rule>
return ruleCandidates;
}*/
public static ArrayList<Rule> findRuleCandidatesByTriggerProfile(Profile profile)
{
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();
for(Rule oneRule : ruleCollection)
{
innerloop:
for(Trigger oneTrigger : oneRule.getTriggerSet())
{
if(oneTrigger.getTriggerType() == Trigger.Trigger_Enum.profileActive)
{
String profileName = oneTrigger.getTriggerParameter2().split(triggerParameter2Split)[0];
if(profileName.equals(profile.getName()))
{
ruleCandidates.add(oneRule);
break innerloop; //if the profile is found we don't need to search the other triggers in the same rule
}
}
}
}
return ruleCandidates;
}
public static ArrayList<Rule> findRuleCandidatesByProfile(Profile profile)
public static ArrayList<Rule> findRuleCandidatesByActionProfile(Profile profile)
{
ArrayList<Rule> ruleCandidates = new ArrayList<Rule>();