forked from jens/Automation
tethering type
This commit is contained in:
parent
d74e2eae68
commit
1d7cf00b94
@ -321,6 +321,7 @@ public class ActivityManageRule extends Activity
|
|||||||
case tethering:
|
case tethering:
|
||||||
Intent tetheringEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerTethering.class);
|
Intent tetheringEditor = new Intent(ActivityManageRule.this, ActivityManageTriggerTethering.class);
|
||||||
tetheringEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
|
tetheringEditor.putExtra(intentNameTriggerParameter1, selectedTrigger.getTriggerParameter());
|
||||||
|
tetheringEditor.putExtra(intentNameTriggerParameter2, selectedTrigger.getTriggerParameter2());
|
||||||
startActivityForResult(tetheringEditor, requestCodeTriggerTetheringEdit);
|
startActivityForResult(tetheringEditor, requestCodeTriggerTetheringEdit);
|
||||||
break;
|
break;
|
||||||
case subSystemState:
|
case subSystemState:
|
||||||
@ -1868,6 +1869,7 @@ public class ActivityManageRule extends Activity
|
|||||||
if(resultCode == RESULT_OK)
|
if(resultCode == RESULT_OK)
|
||||||
{
|
{
|
||||||
newTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
|
newTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
|
||||||
|
newTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
|
||||||
newTrigger.setParentRule(ruleToEdit);
|
newTrigger.setParentRule(ruleToEdit);
|
||||||
ruleToEdit.getTriggerSet().add(newTrigger);
|
ruleToEdit.getTriggerSet().add(newTrigger);
|
||||||
this.refreshTriggerList();
|
this.refreshTriggerList();
|
||||||
@ -1891,6 +1893,7 @@ public class ActivityManageRule extends Activity
|
|||||||
Trigger editedTrigger = new Trigger();
|
Trigger editedTrigger = new Trigger();
|
||||||
editedTrigger.setTriggerType(Trigger_Enum.tethering);
|
editedTrigger.setTriggerType(Trigger_Enum.tethering);
|
||||||
editedTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
|
editedTrigger.setTriggerParameter(data.getBooleanExtra(intentNameTriggerParameter1, true));
|
||||||
|
editedTrigger.setTriggerParameter2(data.getStringExtra(intentNameTriggerParameter2));
|
||||||
editedTrigger.setParentRule(ruleToEdit);
|
editedTrigger.setParentRule(ruleToEdit);
|
||||||
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
ruleToEdit.getTriggerSet().set(editIndex, editedTrigger);
|
||||||
this.refreshTriggerList();
|
this.refreshTriggerList();
|
||||||
|
@ -54,14 +54,19 @@ public class ActivityManageTriggerTethering extends Activity
|
|||||||
{
|
{
|
||||||
case tetheringTypeAny:
|
case tetheringTypeAny:
|
||||||
rbTetheringTypeAny.setChecked(true);
|
rbTetheringTypeAny.setChecked(true);
|
||||||
|
break;
|
||||||
case tetheringTypeWifi:
|
case tetheringTypeWifi:
|
||||||
rbTetheringTypeWifi.setChecked(true);
|
rbTetheringTypeWifi.setChecked(true);
|
||||||
|
break;
|
||||||
case tetheringTypeBluetooth:
|
case tetheringTypeBluetooth:
|
||||||
rbTetheringTypeBluetooth.setChecked(true);
|
rbTetheringTypeBluetooth.setChecked(true);
|
||||||
|
break;
|
||||||
case tetheringTypeUsb:
|
case tetheringTypeUsb:
|
||||||
rbTetheringTypeUsb.setChecked(true);
|
rbTetheringTypeUsb.setChecked(true);
|
||||||
|
break;
|
||||||
case tetheringTypeCable:
|
case tetheringTypeCable:
|
||||||
rbTetheringTypeCable.setChecked(true);
|
rbTetheringTypeCable.setChecked(true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1714,6 +1714,8 @@ public class Trigger
|
|||||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringActive));
|
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringActive));
|
||||||
else
|
else
|
||||||
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringNotActive));
|
returnString.append(Miscellaneous.getAnyContext().getResources().getString(R.string.tetheringNotActive));
|
||||||
|
|
||||||
|
returnString.append(" (" + Miscellaneous.getAnyContext().getResources().getString(R.string.type) + ": " + triggerParameter2 + ")");
|
||||||
break;
|
break;
|
||||||
case subSystemState:
|
case subSystemState:
|
||||||
Trigger.subSystemStates desiredState = subSystemStates.valueOf(triggerParameter2);
|
Trigger.subSystemStates desiredState = subSystemStates.valueOf(triggerParameter2);
|
||||||
|
@ -6,6 +6,7 @@ import android.content.IntentFilter;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.jens.automation2.ActivityManageTriggerTethering;
|
||||||
import com.jens.automation2.AutomationService;
|
import com.jens.automation2.AutomationService;
|
||||||
import com.jens.automation2.Miscellaneous;
|
import com.jens.automation2.Miscellaneous;
|
||||||
import com.jens.automation2.Rule;
|
import com.jens.automation2.Rule;
|
||||||
@ -62,10 +63,21 @@ public class TetheringReceiver extends android.content.BroadcastReceiver impleme
|
|||||||
if(((ArrayList<String>)ob).size() > 0)
|
if(((ArrayList<String>)ob).size() > 0)
|
||||||
{
|
{
|
||||||
tetheringActive = true;
|
tetheringActive = true;
|
||||||
|
if(lastTetheringTypes == null)
|
||||||
|
lastTetheringTypes = new ArrayList<>();
|
||||||
|
else
|
||||||
|
lastTetheringTypes.clear();
|
||||||
|
|
||||||
for(String adapterName : (ArrayList<String>)ob)
|
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
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user