tethering type

development-stable
Jens 6 months ago
parent d74e2eae68
commit 1d7cf00b94

@ -321,6 +321,7 @@ public class ActivityManageRule extends Activity
case tethering:
Intent tetheringEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerTethering.class);
tetheringEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
tetheringEditor.putExtra(intentNameTriggerParameter2, selectedTrigger.getTriggerParameter2());
startActivityForResult(tetheringEditor, requestCodeTriggerTetheringEdit);
break;
case subSystemState:
@ -1868,6 +1869,7 @@ public class ActivityManageRule extends Activity
if(resultCode == RESULT_OK)
{
newTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
newTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
newTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().add(newTrigger);
this.refreshTriggerList();
@ -1891,6 +1893,7 @@ public class ActivityManageRule extends Activity
Trigger editedTrigger = new Trigger();
editedTrigger.setTriggerType(Trigger_Enum.tethering);
editedTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
editedTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
editedTrigger.setParentRule(ruleToEdit);
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
this.refreshTriggerList();

@ -54,14 +54,19 @@ public class ActivityManageTriggerTethering extends Activity
{
case tetheringTypeAny:
rbTetheringTypeAny.setChecked(true);
break;
case tetheringTypeWifi:
rbTetheringTypeWifi.setChecked(true);
break;
case tetheringTypeBluetooth:
rbTetheringTypeBluetooth.setChecked(true);
break;
case tetheringTypeUsb:
rbTetheringTypeUsb.setChecked(true);
break;
case tetheringTypeCable:
rbTetheringTypeCable.setChecked(true);
break;
default:
}
}

@ -1714,6 +1714,8 @@ public class Trigger
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringActive));
else
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringNotActive));
returnString.append(" (" + Miscellaneous.getAnyContext().getResources().getString(R.string.type) + ": " + triggerParameter2 + ")");
break;
case subSystemState:
Trigger.subSystemStates desiredState = subSystemStates.valueOf(triggerParameter2);

@ -6,6 +6,7 @@ import android.content.IntentFilter;
import android.os.Build;
import android.util.Log;
import com.jens.automation2.ActivityManageTriggerTethering;
import com.jens.automation2.AutomationService;
import com.jens.automation2.Miscellaneous;
import com.jens.automation2.Rule;
@ -62,10 +63,21 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
if(((ArrayList<String>)ob).size() > 0)
{
tetheringActive = true;
if(lastTetheringTypes == null)
lastTetheringTypes = new ArrayList<>();
else
lastTetheringTypes.clear();
for(String adapterName : (ArrayList<String>)ob)
{
String test = adapterName;
if(adapterName.contains("wlan"))
lastTetheringTypes.add(ActivityManageTriggerTethering.tetheringTypeWifi);
else if(adapterName.contains("bluetooth"))
lastTetheringTypes.add(ActivityManageTriggerTethering.tetheringTypeBluetooth);
else if(adapterName.contains("usb"))
lastTetheringTypes.add(ActivityManageTriggerTethering.tetheringTypeUsb);
else if(adapterName.contains("ndis"))
lastTetheringTypes.add(ActivityManageTriggerTethering.tetheringTypeCable);
}
}
else

Loading…
Cancel
Save