tethering type

This commit is contained in:
Jens 2022-08-17 23:36:30 +02:00
parent 4f7c36c4f7
commit d74e2eae68
3 changed files with 28 additions and 2 deletions

View File

@ -977,7 +977,19 @@ public class Trigger
boolean checkTetheringActive()
{
return TetheringReceiver.isTetheringActive() == triggerParameter;
if(TetheringReceiver.isTetheringActive() == triggerParameter)
{
if(getTriggerParameter2().equals(ActivityManageTriggerTethering.tetheringTypeAny))
return true;
for(String oneOfLastTypes : TetheringReceiver.getLastTetheringTypes())
{
if(oneOfLastTypes.equals(getTriggerParameter2()))
return true;
}
}
return false;
}
public boolean checkDateTime(Object triggeringObject, boolean checkifStateChangedSinceLastRuleExecution)

View File

@ -12,6 +12,7 @@ import com.jens.automation2.Rule;
import com.jens.automation2.Trigger;
import java.util.ArrayList;
import java.util.List;
public class TetheringReceiver extends android.content.BroadcastReceiver implements AutomationListenerInterface
{
@ -20,8 +21,14 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
private static TetheringReceiver receiverInstance = null;
private static IntentFilter intentFilter = null;
private static List<String> lastTetheringTypes = null;
private static boolean tetheringActive = false;
public static List<String> getLastTetheringTypes()
{
return lastTetheringTypes;
}
public static TetheringReceiver getInstance()
{
if(receiverInstance == null)
@ -53,7 +60,14 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
if(key.equals(target) && ob instanceof ArrayList)
{
if(((ArrayList<String>)ob).size() > 0)
{
tetheringActive = true;
for(String adapterName : (ArrayList<String>)ob)
{
String test = adapterName;
}
}
else
tetheringActive = false;
}

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.android.tools.build:gradle:7.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files