diff --git a/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java b/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java index 31930b53..99e17f1e 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java @@ -26,9 +26,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.ActivityCompat; -import com.jens.automation2.receivers.BluetoothReceiver; - -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -41,7 +38,7 @@ public class ActivityManageTriggerWifi extends Activity RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected; EditText etTriggerWifiName; Spinner spinnerWifiList; - Button btriggerWifiSave, bLoadWifiList; + Button bTriggerWifiSave, bLoadWifiList; List wifiList = new ArrayList<>(); ArrayAdapter wifiSpinnerAdapter; private final static int requestCodeLocationPermission = 124; @@ -56,7 +53,7 @@ public class ActivityManageTriggerWifi extends Activity rbTriggerWifiDisconnected = (RadioButton) findViewById(R.id.rbTriggerWifiDisconnected); etTriggerWifiName = (EditText) findViewById(R.id.etTriggerWifiName); spinnerWifiList = (Spinner) findViewById(R.id.spinnerWifiList); - btriggerWifiSave = (Button) findViewById(R.id.btriggerWifiSave); + bTriggerWifiSave = (Button) findViewById(R.id.bTriggerWifiSave); bLoadWifiList = (Button) findViewById(R.id.bLoadWifiList); wifiSpinnerAdapter = new ArrayAdapter(this, R.layout.text_view_for_poi_listview_mediumtextsize, wifiList); @@ -74,7 +71,7 @@ public class ActivityManageTriggerWifi extends Activity etTriggerWifiName.setText(wifiName); } - btriggerWifiSave.setOnClickListener(new View.OnClickListener() + bTriggerWifiSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) diff --git a/app/src/main/java/com/jens/automation2/Trigger.java b/app/src/main/java/com/jens/automation2/Trigger.java index 4bdc29bf..e8a55329 100644 --- a/app/src/main/java/com/jens/automation2/Trigger.java +++ b/app/src/main/java/com/jens/automation2/Trigger.java @@ -1,6 +1,7 @@ package com.jens.automation2; import android.bluetooth.BluetoothDevice; +import android.content.BroadcastReceiver; import android.content.Context; import android.os.Build; import android.service.notification.StatusBarNotification; @@ -728,7 +729,8 @@ public class Trigger if(this.getTriggerParameter2().length() > 0) // only check if any wifi name specified, otherwise any wifi will do { Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format("Wifi name specified, checking that.", this.getParentRule().getName()), 4); - if(!WifiBroadcastReceiver.getLastWifiSsid().equals(this.getTriggerParameter2())) + + if(!WifiBroadcastReceiver.getLastWifiSsid().equals(this.getTriggerParameter2()) && !(Miscellaneous.isRegularExpression(this.getTriggerParameter2()) && WifiBroadcastReceiver.getLastWifiSsid().matches(this.getTriggerParameter2()))) { Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyNotTheCorrectSsid), getParentRule().getName(), this.getTriggerParameter2(), WifiBroadcastReceiver.getLastWifiSsid()),this.getParentRule().getName()), 3); return false; diff --git a/app/src/main/res/layout/activity_manage_trigger_wifi.xml b/app/src/main/res/layout/activity_manage_trigger_wifi.xml index 7ea198cb..c21adcfb 100644 --- a/app/src/main/res/layout/activity_manage_trigger_wifi.xml +++ b/app/src/main/res/layout/activity_manage_trigger_wifi.xml @@ -62,6 +62,16 @@ + + + + + + +