Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <Lockscreen version="1" frameRate="60" screenWidth="720">
- <!--Constructing the orientation sensor.-->
- <VariableBinders>
- <SensorBinder type="orientation">
- <!--Specifyingthe type-->
- <Variable name="_orientation_x" index="0" />
- <Variable name="_orientation_y" index="1" />
- <!--Declaring the 3 variable to assign the gravity value in each axis.-->
- <Variable name="_orientation_z" index="2" />
- </SensorBinder>
- </VariableBinders>
- <!--Ploting a background image in the lockscreen at the position (0,0) and height(h)=#screen_height
- and width(w)="#screen_width"-->
- <Image src="images/bg_blue.png" x="0" y="0" h="#screen_height" w="#screen_width" />
- <!--Constructing an image group that will build a compass.-->
- <Group>
- <Image x="#screen_width/2" y="#screen_height/2" align="center" alignV="center" w="400" h="400" src="images/bg.png" />
- <!--The sensor will be used in this image to rotate it. pivotX and pivotY specify the rotation point, in this case, in the image center.
- The rotation will be according to orientation in the axis x that we can obtain with the sensor variable _orientation_x-->
- <Image x="#screen_width/2" y="#screen_height/2" align="center" alignV="center" w="400" h="400" pivotX="200" pivotY="200" rotation="-#_orientation_x" src="images/arrow.png" />
- <Image x="#screen_width/2" y="#screen_height/2" align="center" alignV="center" w="400" h="400" pivotX="200" src="images/thumb.png" />
- </Group>
- <!--If you want to see the sensor variable values on screen uncomment the lines below-->
- <!--<Text x="10" y="10" size="20" format="Orientation x: %d" paras="#_orientation_x" color="#000000" />
- <Text x="10" y="40" size="20" format="Orientation y: %d" paras="#_orientation_y" color="#000000" />
- <Text x="10" y="70" size="20" format="Orientation z: %d" paras="#_orientation_z" color="#000000" />-->
- <!--This part of the code unlock the screen when the orientation is pointing to north(in this case we are
- using the interval 359-360 and 1-3). When the _orientation_x is one of this values the screen is unlock.-->
- <Var name="_unlock" expression="gt(#_orientation_x,358)*le(#_orientation_x,360) + ge(#_orientation_x,1)*le(#_orientation_x,3)">
- <Trigger>
- <!--Delay(The time to unlock the lockscreen)-->
- <ExternCommand command="unlock" delay="500" />
- </Trigger>
- </Var>
- <!--Here we create an unlock to when the user double click on screen-->
- <!--We create a buttom that has the screen size. haptic(To vibrate)-->
- <Button name="_screen_button" x="0" y="0" w="#screen_width" h="#screen_height" haptic="true">
- <Triggers>
- <Trigger action="double">
- <!--Delay(The time to unlock the lockscreen)-->
- <ExternCommand command="unlock" delay="500" />
- </Trigger>
- <Trigger action="up">
- <!-- do something -->
- </Trigger>
- <Trigger action="down">
- <!-- do something -->
- </Trigger>
- </Triggers>
- </Button>
- </Lockscreen>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement