Media player menu help

Post your questions and help other users.

Moderator: Martin

Post Reply
Amaj
Posts: 1
Joined: 22 Mar 2015 17:48

Media player menu help

Post by Amaj » 22 Mar 2015 17:59

Hiya all,

I'm trying to set up, what is essentially, my own driving mode. My requirements are:

1. open a menu with 5 choices
2. if any of these are selected switch off screen lock and screen timeout, then open the applicable app
3. but whenever the selected app is closed, I want to reinstate the screen lock and timout

I attach what I've attempted so far (please ignore the test options I've left in there temporarily).

PS - I was all ready to upload the file but it states "the uploaded file was identified as a possible attack vector" and won't allow it so I've pasted it below.


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <data version="1.27.0">
- <trigger type="shortcut">
<useDefaultName>false</useDefaultName>
<name>Driving</name>
<enabled>false</enabled>
<title>Driving</title>
</trigger>
- <condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: setValue(DrivingActive, "On")</name>
<expression>setValue(DrivingActive, "On")</expression>
</condition>
- <condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: startsWith(value,"Audible")</name>
<expression>startsWith(value,"Audible")</expression>
</condition>
- <condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: startsWith(value,"PC Radio")</name>
<expression>startsWith(value,"PC Radio")</expression>
</condition>
- <condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: startsWith(value,"Play Music")</name>
<expression>startsWith(value,"Play Music")</expression>
</condition>
- <condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: startsWith(value,"PowerAmp")</name>
<expression>startsWith(value,"PowerAmp")</expression>
</condition>
- <condition type="expression">
<useDefaultName>true</useDefaultName>
<name>Expression: startsWith(value,"Spotify")</name>
<expression>startsWith(value,"Spotify")</expression>
</condition>
- <action type="input_dialog">
<useDefaultName>true</useDefaultName>
<name>Input Dialog: Select app to run Single Choice Audible, PC Radio, Play Music, PowerAmp, Spotify (5s)</name>
<title>Select app to run</title>
<inputDialogType>SINGLE_CHOICE</inputDialogType>
<prompt />
<inputValues>Audible, PC Radio, Play Music, PowerAmp, Spotify</inputValues>
<defaultValue>PowerAmp</defaultValue>
<timeoutEnabled>true</timeoutEnabled>
<timeout>5000</timeout>
<defaultValueOnTimeout>PowerAmp</defaultValueOnTimeout>
<showWhenLocked>false</showWhenLocked>
<turnScreenOn>false</turnScreenOn>
<keepScreenOn>false</keepScreenOn>
</action>
- <action type="launch_app">
<useDefaultName>true</useDefaultName>
<name>Launch App: com.audible.application</name>
<packageName>com.audible.application</packageName>
<className />
</action>
- <action type="launch_app">
<useDefaultName>true</useDefaultName>
<name>Launch App: com.google.android.music</name>
<packageName>com.google.android.music</packageName>
<className />
</action>
- <action type="launch_app">
<useDefaultName>true</useDefaultName>
<name>Launch App: com.maxmpz.audioplayer</name>
<packageName>com.maxmpz.audioplayer</packageName>
<className />
</action>
- <action type="launch_app">
<useDefaultName>true</useDefaultName>
<name>Launch App: com.maxxt.pcradio</name>
<packageName>com.maxxt.pcradio</packageName>
<className />
</action>
- <action type="launch_app">
<useDefaultName>true</useDefaultName>
<name>Launch App: com.spotify.music</name>
<packageName>com.spotify.music</packageName>
<className />
</action>
- <action type="notification_screen">
<useDefaultName>true</useDefaultName>
<name>Notification on Screen: {DrivingActive}</name>
<showText>true</showText>
<text>{DrivingActive}</text>
<widgetName />
<width>200</width>
<height>250</height>
<stretchToFillArea>false</stretchToFillArea>
<opacity>1.0</opacity>
<durationLong>false</durationLong>
<customPosition>false</customPosition>
<gravityType>TOP_LEFT</gravityType>
<xOffset>0</xOffset>
<yOffset>0</yOffset>
</action>
- <action type="script">
<useDefaultName>true</useDefaultName>
<name>Script: setValue(DrivingActive, "Off")</name>
<script>setValue(DrivingActive, "Off")</script>
</action>
- <action type="set_keyguard_state">
<useDefaultName>true</useDefaultName>
<name>Set Keyguard State: Off</name>
<enable>false</enable>
</action>
- <action type="set_keyguard_state">
<useDefaultName>true</useDefaultName>
<name>Set Keyguard State: On</name>
<enable>true</enable>
</action>
- <action type="set_screen_timeout">
<useDefaultName>true</useDefaultName>
<name>Set Screen Timeout: 30 Seconds</name>
<screenTimeoutValue>SECONDS_30</screenTimeoutValue>
</action>
- <action type="set_screen_timeout">
<useDefaultName>true</useDefaultName>
<name>Set Screen Timeout: Never</name>
<screenTimeoutValue>NEVER</screenTimeoutValue>
</action>
- <flow type="flow">
<name>Driving</name>
<enabled>false</enabled>
<executionPolicy>PARALLEL</executionPolicy>
<conditioncontainer id="t1" x="245.0" y="1137.5">Expression: startsWith(value,"Spotify")</conditioncontainer>
<actioncontainer id="t2" x="69.99999" y="17.5">Set Screen Timeout: Never</actioncontainer>
<actioncontainer id="t3" x="-105.00001" y="17.500008">Set Keyguard State: Off</actioncontainer>
- <triggercontainer id="t4" x="70.00001" y="-297.49994">
<trigger>Driving</trigger>
</triggercontainer>
<actioncontainer id="t5" x="419.99994" y="1137.5">Launch App: com.maxmpz.audioplayer</actioncontainer>
<actioncontainer id="t6" x="420.0" y="1312.5">Launch App: com.spotify.music</actioncontainer>
<conditioncontainer id="t7" x="594.99994" y="927.5">Expression: setValue(DrivingActive, "On")</conditioncontainer>
<conditioncontainer id="t8" x="594.99994" y="1277.5">Expression: setValue(DrivingActive, "On")</conditioncontainer>
<conditioncontainer id="t9" x="594.99994" y="1452.5">Expression: setValue(DrivingActive, "On")</conditioncontainer>
<conditioncontainer id="t10" x="594.99994" y="1102.5">Expression: setValue(DrivingActive, "On")</conditioncontainer>
<conditioncontainer id="t11" x="245.0" y="787.5">Expression: startsWith(value,"Play Music")</conditioncontainer>
<conditioncontainer id="t12" x="244.99998" y="402.5">Expression: startsWith(value,"Audible")</conditioncontainer>
<actioncontainer id="t13" x="665.0" y="227.49997">Set Keyguard State: On</actioncontainer>
<actioncontainer id="t14" x="665.00006" y="402.4999">Set Screen Timeout: 30 Seconds</actioncontainer>
<actioncontainer id="t15" x="419.99988" y="787.4999">Launch App: com.maxxt.pcradio</actioncontainer>
<conditioncontainer id="t16" x="594.99994" y="752.50006">Expression: setValue(DrivingActive, "On")</conditioncontainer>
<actioncontainer id="t17" x="419.99988" y="612.5">Launch App: com.audible.application</actioncontainer>
<actioncontainer id="t18" x="419.99994" y="962.4999">Launch App: com.google.android.music</actioncontainer>
<conditioncontainer id="t19" x="245.0" y="962.5">Expression: startsWith(value,"PowerAmp")</conditioncontainer>
<conditioncontainer id="t20" x="245.0" y="612.5">Expression: startsWith(value,"PC Radio")</conditioncontainer>
<actioncontainer id="t21" x="455.00006" y="192.50003">Notification on Screen: {DrivingActive}</actioncontainer>
<actioncontainer id="t22" x="245.0" y="17.500023">Input Dialog: Select app to run Single Choice Audible, PC Radio, Play Music, PowerAmp, Spotify (5s)</actioncontainer>
<actioncontainer id="t23" x="245.0" y="192.50003">Script: setValue(DrivingActive, "Off")</actioncontainer>
<connection from="t1" to="t6" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t4" to="t3" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t4" to="t2" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t4" to="t22" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t5" to="t8" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t6" to="t9" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t11" to="t18" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t11" to="t19" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t12" to="t17" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t12" to="t20" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t13" to="t14" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t17" to="t16" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t18" to="t10" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t19" to="t1" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t19" to="t5" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t20" to="t11" type="FALSE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t20" to="t15" type="TRUE" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t21" to="t13" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t22" to="t21" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
<connection from="t23" to="t12" type="NORMAL" sourcePosition="SOUTH" targetPosition="NORTH" />
</flow>
</data>

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Media player menu help

Post by Martin » 24 Mar 2015 18:49

Hi,

The XML is hard to read, could you please share the flow directly with Automagic?
To do this, open the Forum in Automagic (on the flow list: menu->Forum). There's a dark greenish button on the bottom of the screen. Press the button and select the flow. Automagic uploads the Flow to our server and creates a link on the clipboard. You can paste the link in a reply.

Regards,
Martin

Post Reply