forked from jens/Automation
Enabled variables as intent parameters
This commit is contained in:
parent
bd2920e6d9
commit
a76cafc6e2
@ -10,8 +10,6 @@ import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
@ -1166,21 +1164,36 @@ public class Actions
|
||||
}
|
||||
else if (singleParam[0].equals("Uri"))
|
||||
{
|
||||
if (singleParam[1].equalsIgnoreCase("IntentData"))
|
||||
try
|
||||
{
|
||||
Miscellaneous.logEvent("i", "StartOtherApp", "Adding parameter of type " + singleParam[0] + " with value " + singleParam[2] + " as standard data parameter.", 3);
|
||||
intent.setData(Uri.parse(singleParam[2]));
|
||||
if (singleParam[1].equalsIgnoreCase("IntentData"))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "StartOtherApp", "Adding parameter of type " + singleParam[0] + " with value " + singleParam[2] + " as standard data parameter.", 3);
|
||||
intent.setData(Uri.parse(Miscellaneous.replaceVariablesInText(singleParam[2], context)));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Miscellaneous.logEvent("i", "StartOtherApp", "Adding parameter of type " + singleParam[0] + " with name " + singleParam[1] + " and value " + singleParam[2], 3);
|
||||
intent.putExtra(singleParam[1], Uri.parse(Miscellaneous.replaceVariablesInText(singleParam[2], context)));
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("i", "StartOtherApp", "Adding parameter of type " + singleParam[0] + " with name " + singleParam[1] + " and value " + singleParam[2], 3);
|
||||
intent.putExtra(singleParam[1], Uri.parse(singleParam[2]));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
else if (singleParam[0].equals("String"))
|
||||
{
|
||||
Miscellaneous.logEvent("i", "StartOtherApp", "Adding parameter of type " + singleParam[0] + " with name " + singleParam[1] + " and value " + singleParam[2], 3);
|
||||
intent.putExtra(singleParam[1], singleParam[2]);
|
||||
try
|
||||
{
|
||||
intent.putExtra(singleParam[1], Miscellaneous.replaceVariablesInText(singleParam[2], context));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
intent.putExtra(singleParam[1], singleParam[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
Miscellaneous.logEvent("w", "StartOtherApp", "Unknown type of parameter " + singleParam[0] + " found. Name " + singleParam[1] + " and value " + singleParam[2], 3);
|
||||
|
@ -304,6 +304,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/addIntentValue" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="25dp"
|
||||
android:text="@string/variablesOnlyForTypes" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvLegend"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/urlLegend" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
|
@ -884,4 +884,5 @@
|
||||
<string name="textToCopy">Text to copy</string>
|
||||
<string name="android.permission.SYSTEM_ALERT_WINDOW">Draw over other apps</string>
|
||||
<string name="overlayPermissionHint">After clicking OK you\'ll be sent to a system dialog. Please select Automation there and allow "draw over other apps".</string>
|
||||
<string name="variablesOnlyForTypes">Variables are only available for parameter types String and URI</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user