diff --git a/app/src/main/java/com/jens/automation2/Actions.java b/app/src/main/java/com/jens/automation2/Actions.java index 59db6c67..560b17d3 100644 --- a/app/src/main/java/com/jens/automation2/Actions.java +++ b/app/src/main/java/com/jens/automation2/Actions.java @@ -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); diff --git a/app/src/main/res/layout/activity_manage_action_start_activity.xml b/app/src/main/res/layout/activity_manage_action_start_activity.xml index d89bc77a..fbf5fba7 100644 --- a/app/src/main/res/layout/activity_manage_action_start_activity.xml +++ b/app/src/main/res/layout/activity_manage_action_start_activity.xml @@ -304,6 +304,18 @@ android:layout_height="wrap_content" android:text="@string/addIntentValue" /> + + + + Text to copy Draw over other apps After clicking OK you\'ll be sent to a system dialog. Please select Automation there and allow "draw over other apps". + Variables are only available for parameter types String and URI \ No newline at end of file