Remove All Ads from XDA

MIUI new lockscreen manifest reference (6.26.2012 updated, MIUI lockscreen 2.0)

79 posts
Thanks Meter: 98
By pomenx, Member on 29th June 2011, 05:43 AM
Post Reply Email Thread
I think it's time to bring MIUI lockscreen to the 2.0 era after added many new features. before I didn't have too much time to work on it, so there were not too many big updates, from now on hopefully I will invest much more time on it.

In the mtz theme package, you can find the lockscreen/advance directory, the manifest.xml file is the description script, in xml.

newly added:
extended ifelse function: (MIUI v4 2.6.22)
ifelse(x1, y1, x2, y2, ... , z)
// if x1>0 return y1; else if x2>0 return y2; ... ; else return z

virtual screen element
<VirtualScreen name="virtualscreen">
which is a group, all its children elements will be drew in its own bitmap buffer, this buffer can be used as the source of an Image :
<Image useVirtualScreen="true" src="virtualscreen">

Image 3D rotation
<Image angleX="" angleY="">
angleX : rotate around x axis
angleY : rotate around y axis
rotate center is: centerX, centerY

specifying Image resource region
<Image srcX="" srcY="" srcW="" srcH="" >
please refer to the unfold lockscreen to see the real code.

support query webservice

------------ above is only for MIUI v4 2.6.8 or later ---------------

dynamic frame rate
1) you can specify different frame rate under different scenes.
<Lockscreen frameRateCharging="30" frameRateBatteryLow="20" frameRateBatteryFull="1">

2) added a new element, FramerateController, which can specify dynamic frame rate in timeline. add it into a container, then it can set the requested framerate at the time point,
it looks like:
<FramerateController visibility="#music_control.visibility" loop="true">
<ControlPoint time="0" frameRate="20"/>
<ControlPoint time="1000" frameRate="0"/>
<ControlPoint time="3000"/>

refer to the builtin default theme for real code.

------------ above is only for MIUI v4 ---------------
lockscreen on 2.3 will not update.


support formating of “where”
<ContentProviderBinder where="" whereFormat="" whereParas="">

content provider supports dependency, variables acquired after the query of a ContentProviderBinder can be used as the query parameter of another ContentProviderBinder

<ContentProviderBinder name="name1" dependency="name2">
<ContentProviderBinder name="name2" >
after name2 query complete, name1 could use the variables binded in name2 as format parameters. and if the data changes in name2 and triggers the query of name2, it will also trigger the query of name1 after query complete of name2.

content provider support
logic functions and select function
a new component which uses image to display a given number

unlocker bounce animation when released.
<Unlocker name="unlocker" bounceInitSpeed="10" bounceAcceleration="1500">
this is the unlocker code swipe from left to right, the 2 newly added attributes are the initial speed and the acceleration (in pixel and second), they all support expression.

<Unlocker name="unlocker" bounceInitSpeed="-5*#unlocker.move_y" bounceAcceleration="12.5*#unlocker.move_y">
this is the code swipe from bottom to top, the initial speed expression means the farther it moves the faster the speed it starts with. because the move_y is minus if it slides upward, so add a minus to the expression. the acceleration expression is calculated from the end speed you want it to be. for example we want the unlocker's speed be 0 when it gets back to original position, then we can get the acceleration should be a=-v*v/2d a:acceleration v:speed d:move distance

text element now has the text width variable. you can use it to align text elements horizontally.
name: text_width
<Text name="tt" .../>


the actual position variables of an element, acquire the position in animation. actual_x actual_y

<Image name="img" ... >

#img.actual_x #img.actual_y

support formatting of string variable
<Text format="Next alarm:[%s] Battery:[%d%%]" paras="@next_alarm_time,#battery_level"/>

text and date rotation <Text angle=""/>

support string variable .

<Text text="@next_alarm_time" .../>

* Text/DateTime support rotation now.

* screen element visibility supports expression
visibility=“expression” <=0 invisible >0 visible

* MusicControl
added attribute "autoShow", true/false it indicates whether show the music control automatically when entering lockscreen
added variables
music_state, this number indicates the playback state 0:stopped 1laying
visibility, this number indicates the visibility of music control 0=false 1=true

a) ability to show home screen, if no lockscreen wallpaper or the lockscreen wallpaper can be moved away, you can see through to the home screen(launcher or the previous app). can be used to simulate lockscreens of WP7, Meego, Ali cloud, etc.

displayDesktop property of Lockescreen false by default
<Lockescreen displayDesktop="true">

b) sound effect with unlocker
StartPoint: normalSound, pressedSound specify the sound to be played when change to normal or pressed.
EndPoint: reachedSound, specify the sound to be played when reach this endpoint.

<Unlocker name="unlocker">
<StartPoint x="0" y="440" w="480" h="400" normalSound="sound_normal.mp3" pressedSound="sound_normal.mp3">
<EndPoint x="0" y="640" w="480" h="400" reachedSound="sound_reached.mp3">

property of Image, Text, Time
align=left, center, right the horizontal align mode
property of Image, Time
alignV= top, center, bottom the vertical align mode.
function: round() int() , if u don't know them, never mind, you don't need them.
music control supports album cover. see music control part.
Image add property: antiAlias by default is false, for clock hand images you can set it true to make them smooth.

1. Image element
you can use Image element to display a picture on the screen with many properties.

<Image x="" y="" w="" h="" centerX="" centerY="" angle="" src="" srcid="" alpha="" antiAlias=""/>

x,y : the position of the image relative to the upper-left point of the screen. both are 0 by default.
w,h : width and height, the image original width and height by default.
centerX, centerY : rotation center relative to the upper-left point of the image.
angle : rotation degree, 0-360
src : picture name.
srcid : the sequence number of a serial of pictures, normally it will be an expression which will be evaluated to a number. Then the image element will display different pictures according to the number. For instance, given src="pic.png" srcid="1", it will display the picture "pic_1.png".

alpha : the opacity, 0-255, will not display if alpha<=0, and >=255 just no difference from 255.
antiAlias: true/false

<Image x="0" y="#screen_height-323" src="bottom_bg.png"/>

2. Expression.
All number properties supports expression. An expression can contain any kind of combinations of plus, minus, multiply, divid, modulo, brackets, functions and variables.
+ - * / %
functions: sin, cos, tan, asin, acos, atan, sinh, cosh, sqrt, abs, min, max

len(number) get the digit count of the given number, e.g. len(1234)=4
digit(number, pos) get the nth digit of the given number, e.g. digit(1234, 2) = 3

3. Variables
Variables can be used in expressions. A variable starts with a #.
currently supported variables:

* unlocker properties, format: e.g. #unlocker.move_x
move_x: the move offset on x axis when unlocking, can be minus.
move_y: the move offset on y axis when unlocking, can be minus.
move_dist: the move distance when unlocking.
state: unlocking state normal:0 pressed:1 reached:2

* globals
time: current time, long
touch_x, touch_y: current touch point
battery_level: battery level 0-100
sms_unread_count: unread sms
call_missed_count: missed calls

* date & time
ampm: // 0 am, 1 pm
hour12: hour, 12 hours
hour24: hour in the day, 24 hours
month: //0-11
date: day
day_of_week // 1-7 Sun - Sat

screen_width: screen width
screen_height: screen height

battery_state: the state of plug and battery normal:0 charging:1 battery low:2 battery full:3


alpha means this picture only display in non charging state, and will became transparent gradually along the unlocker dragging.
1. <Image x="162" y="#screen_height-84" src="hs_path_bg.png" alpha="(255-#unlocker.move_x/100*255)*min(1, abs(1-#battery_state))"/>

4. Image element can have animations.
Animation types: picture source, position, size, rotation, alpha.
Animations are independent to each other, they play on their own timeline and loop. An animation contains some key frame items. A key frame including properties and time. Except the source animation, other animations will interpolate the current properties according to current time and the properties of the adjacent two key frames. If the first key frame time is not 0, then the default key frame of time 0 will be the original picture properties. Time unit is ms.
for instance:
below is a position animation, if current time is 1600, 1600 mod 1000 = 600, x=10 + (600-100)/(1000-100)*(100-10) = 60 y=120

1. <Image>
2. <PositionAnimation>
3. <Position x="10" y="20" time="100"/>
4. <Position x="100" y="200" time="1000"/>
5. </PositionAnimation>
6. </Image>

time 0 100 [600] 1000
| | | |
x,y 10, 20 60,120 100, 200

The position is relative to the image's position.


8. other animations:
9. <RotationAnimation>
10. <Rotation angle="" time=""/>
11. <Rotation angle="" time=""/>
12. </RotationAnimation>
14. <SizeAnimation>
15. <Size w="" h="" time=""/>
16. <Size w="" h="" time=""/>
17. </SizeAnimation>

19. <!-- 0-255 -->
20. <AlphaAnimation>
21. <Alpha a="" time=""/>
22. <Alpha a="" time=""/>
23. </AlphaAnimation>

The source animation is a little different from others, current picture is the first key frame source that is bigger than current time.
x, y is optional, means the relative position to the Image.

1. <SourcesAnimation>
2. <!-- optional: x y -->
3. <Source x="" y="" src="pic1.png" time="100"/>
4. <Source x="" y="" src="pic2.png" time="1000"/>
5. </SourcesAnimation>

if current time is 1600, the picture is pic2.png

The position animation means the picture moves smoothly from the left of screen to the right in 1 second, stops for 1 second. The alpha animation means the opacity starts from 175, keep it when moving from left to right, when arrive at the right side, becomes 255 in 0.5 second, then disappears gradually in 0.5 second. And loop.

1. <Image x="0" y="#screen_height-177" src="charging_light.png" category="Charging">
2. <PositionAnimation>
3. <Position x="480" y="0" time="1000"/>
4. <Position x="480" y="0" time="2000"/>
5. </PositionAnimation>
6. <AlphaAnimation>
7. <Alpha a="175" time="0"/>
8. <Alpha a="175" time="1000"/>
9. <Alpha a="255" time="1500"/>
10. <Alpha a="0" time="2000"/>
11. </AlphaAnimation>
12. </Image>

5. Image can have masks.
x,y: the position of mask.
src: the mask picture, normally we use black to fill non-transparent area. and alpha channel will be used to mask the image. note that area in the Image that is out of the mask will keep intact.
align: indicates the position is relative to the Image or absolute.
1. <Mask x="" y="" src="" centerX="" centerY="" angle="" align="">
2. <SourcesAnimation/>
3. <RotationAnimation/>
4. <PositionAnimation/>
5. </Mask>

Mask can also have source animation, rotation animation, position animation, properties also support expression.

below is the dotted glowing arrow animation indicates the unlock path.
1. <Image x="444" y="#screen_height-92" src="hs_path_light.png">
2. <PositionAnimation>
3. <Position x="-438" y="0" time="2000"/>
4. </PositionAnimation>
5. <Mask x="0" y="#screen_height-92" src="hs_path_mask_r.png" align="absolute"/>
6. </Image>

6. Category property
All elements except the unlocker can be designated a category property. It has three values: Charging, BatteryLow, BatteryFull, Normal. The element with a category property will only show at the designated state. Can be used to display charging text, charging animations.
e.g. <Image x="100" y="100" src="pic.png" category="Charging"/>

7. Time
src is the prefix and ext of digit pictures, the code below means using time_0.png, time_1.png, ... time_9.png, time_dot.png
1. <Time x="10" y="10" src="time.png">
2. </Time>

8. Text
Display text on the screen, supports format.
color: #FFFFFFFF
format: used to show variable numbers in text
align:left, center, right
paras: the variables need to be show in format.
Text added marquee feature, if specified width and marqueeSpeed, it will marquee text when text is wider than width
1. <Text x="" y="" text="" color="" size="" format="" paras="#x,#y" align="" marqueeSpeed="">
2. <PositionAnimation/>
3. </Text>

1. <Text x="240" y="130+#unlocker.move_y" category="Charging" color="#AAFFFFFF" alpha="200" size="24" format="Charging (%d%%)" paras="#battery_level" align="center"/>

9. Date & time
Display data and time text in designated format.
format: standard date time format, lunar date: NNNN

1. <DateTime x="" y="" color="" size="" format="">
2. <PositionAnimation/>
3. <DateTime>

Formatting characters may be repeated in order to get more detailed representations
of that field. For instance, the format character M is used to
represent the month. Depending on how many times that character is repeated
you get a different representation.

For the month of September:
M 9
MM 09
MMMM September

The effects of the duplication vary depending on the nature of the field.
See the notes on the individual field formatters for details. For purely numeric
fields such as <code>HOUR</code> adding more copies of the designator will
zero-pad the value to that number of characters.

For 7 minutes past the hour:
m 7
mm 07
mmm 007
mmmm 0007

Examples for April 6, 1970 at 3:23am:
MM/dd/yy h:mmaa 04/06/70 3:23am
MMM dd, yyyy h:mmaa Apr 6, 1970 3:23am
MMMM dd, yyyy h:mmaa April 6, 1970 3:23am
E, MMMM dd, yyyy h:mmaa Mon, April 6, 1970 3:23am
EEEE, MMMM dd, yyyy h:mmaa Monday, April 6, 1970 3:23am
Noteworthy day: M/d/yy Noteworthy day: 4/6/70

24 hours: "kk:mm" -> "13:34"

10. Unlocker
name: used to compose a variable name. e.g.
Can have multiple unlockers.

<Unlocker name="">
start point, specify the valid touch area of unlocking behavior. Elements under a start point will follow the current dragging.
1. <StartPoint x="" y="" w="" h="">

Normal state, can have multiple elements.

3. <NormalState>
4. <Image/>
5. <Time/>
6. <DateTime/>
7. <Text/>
8. </NormalState>

Pressed inside the valid area, starts unlocking. will hide other states elements.

10. <PressedState>
11. <Image/>
12. <Time/>
13. <DateTime/>
14. <Text/>
15. </PressedState>

When reached the unlock target area, show the reached state elements.
17. <ReachedState>
18. <Image/>
19. <Time/>
20. <DateTime/>
21. <Text/>
22. </ReachedState>
23. </StartPoint>

These 3 states can all be absent, just use variable expressions to vary elements to indicate unlock process.

Endpoint specifies the unlock target area, when the start point's x,y enter the target area, release will perform unlock.
1. <EndPoint x="" y="" w="" h="">
The intent to send after unlocking. can be used to launch an app.
3. <Intent action="" type="" category="" package="" class=""/>

5. <NormalState>
6. <Image/>
7. </NormalState>

9. <!-- show the target position if pressed trying to unlock-->
10. <PressedState>
11. <Image/>
13. </PressedState>

15. <!-- show specified image when reached target, if touch up then perform unlock-->
16. <ReachedState>
17. <Image/>
18. </ReachedState>

Unlock path, can have more than 2 points to form a curve path. x,y is optional, tolerance means if dragging beyond this value then cancle the unlocking process, back to normal state. Position's x&y are relative to path's. the start point will be aligned to the path.
Path is also optional, if has no path, the start point can be dragged anywhere.
22. <Path x="" y="" tolerance="">
23. <Position x="" y="" />
24. <Position x="" y="" />
25. </Path>
26. </EndPoint>

can have multiple end points.



1. <Unlocker name="unlocker">
2. <StartPoint x="31" y="#screen_height-117" w="90" h="90">
3. <NormalState>
4. <Image x="31" y="#screen_height-117" src="unlock_button.png">
5. </Image>
6. </NormalState>
7. </StartPoint>
8. <EndPoint x="359" y="#screen_height-117" w="90" h="90">
9. <PressedState>
10. <Image x="359" y="#screen_height-117" src="unlock_target.png">
11. </Image>
12. </PressedState>
13. <Path x="0" y="#screen_height-117">
14. <Position x="31" y="0" />
15. <Position x="359" y="0" />
16. </Path>
17. </EndPoint>
18. </Unlocker>

11. The manifest.xml structure.
Lockscreen is the root, frameRate: specify a frame rate, if the animation is slow you can specify a small value to conserve power. by default is 30. If frameRate is set to 0, the screen will not update till you touch. touch event will cause screen update immediately. The theoratical max value is 100.
The z-order of element is subject to the secquence in xml, display from back to front.

1. <Lockscreen version="1" frameRate="">
2. <Image />
3. <Image />
4. <Unlocker/>
5. <Unlocker/>
6. <Time/>
7. <DateTime/>
8. <Text/>
9. </Lockscreen>

12. Wallpaper element
Wallpaper refers the wallpaper bitmap selected by system setting. It can't specify source, others are the same with Image. If has no Wallpaper element, wallpaper will not show. A Lockscreen may have multiple Wallpaper element.


13. Button element
Button can be used to receive click, double click event, and control other elements according to trigger.

<Button name="" x="" y="" w="" h="" listener="">
All elements 所有元素supports name property, the control target element is being specified by name.
x, y, w, h: specify the button area。
listener, the target element name to which the event of this button will be forward

A button may have multiple trigger, a trigger defines the button event and the related operation should perform, like changing a property.

<Trigger action="" target="" property="" value=""/>
action: down (pressed), up (release), double (double click), long (long click, not implemented for now)
target: the target element name
property: property name, currently only supports: visibility
value: property value , for boolean: true, false, toggle

Button xml structure:

1. <Button>
// can be empty, optional
3. <Triggers>
4. <Trigger/>
5. <Trigger/>
6. </Triggers>

7. // normal state of button, can contain any element like Image, Text, it's optional.
Note: the coordinates of elements and the coordinates of Button itself is separated, they are all relative to parent of Button.

9. <Normal>
10. <Image/>
11. <Text/>
12. ...
13. </Normal>

14. // Pressed state, optional
15. <Pressed>
16. <Image/>
17. <Text/>
18. ...
19. </Pressed>
20. </Button>

14. Music control element
specify a name so its visibility can be controlled by another button.
must have 4 Buttons and 1 Text, and they all must have the specified names like below.
can also contain any other element.

<MusicControl name="music_control" x="" y="">
//album cover, you can specify size, animations, and masks as a normal Image
<Image name="music_album_cover"/>

//song information text
<Text name="music_display"/>
//previous button
<Button name="music_prev"/>
//next button
<Button name="music_next"/>
//play button
<Button name="music_play"/>
//pause button
<Button name="music_pause"/>

<!-- double click to show or hide the music control -->
<Button x="178" y="529" w="126" h="126">
<Trigger action="double" target="music_control" property="visibility" value="toggle"/>

1. <MusicControl x="0" y="300" name="music_control" visibility="false">
<Image name="music_album_cover" x="240" y="40" alpha="150" align="center" alignV="center" />
2. <!-- background image -->
3. <Image src="music_bg.png" x="40" y="0" alpha="100" />
4. <!-- Text added marquee feature, if specified width and marqueeSpeed, it will marquee text when text is wider than width -->
5. <Text name="music_display" x="240" y="10" w="300" marqueeSpeed="30" size="24" color="#FFFFFF" alpha="150" align="center"/>
6. <Button name="music_prev" x="40" y ="40" w="108" h="84">
7. <Normal>
8. <Image src="music_previous_n.png" x="40" y="40" />
9. </Normal>
10. <;Pressed>
11. <Image src="music_previous_p.png" x="40" y="40" />
12. </Pressed>
13. </Button>
14. <Button name="music_next" x="332" y ="40" w="108" h="84">
15. <Normal>
16. <Image src="music_next_n.png" x="332" y="40" />
17. </Normal>
18. <Pressed>
19. <Image src="music_next_p.png" x="332" y="40" />
20. </Pressed>
21. </Button>
22. <Button name="music_play" x="186" y ="40" w="108" h="84">
23. <Normal>
24. <Image src="music_play_n.png" x="186" y="40" />
25. </Normal>
26. <Pressed>
27. <Image src="music_play_p.png" x="186" y="40" />
28. </Pressed>
29. </Button>
30. <Button name="music_pause" x="186" y ="40" w="108" h="84">
31. <Normal>
32. <Image src="music_pause_n.png" x="186" y="40" />
33. </Normal>
34. <Pressed>
35. <Image src="music_pause_p.png" x="186" y="40" />
36. </Pressed>
37. </Button>
38. </MusicControl>


how to control a element to show or not show under multiple combined conditions:

use alpha to control it, each condition can map to the alpha value 0 or 255. if the relation of two conditions is AND, multiply them, if is OR, add them. and brackets also help.

for instance:
if you want to show an Image when device is unplugged or battery is full or the unlock state is normal (not pressed or reached),


<Image src="pic.png" alpha="max(0,(1-#battery_state))*255 + max(0,(#battery_state-2))*255 + max(0,(1-#unlocker.state))*255">

2. leverage screen variables to deal with different resolutions, #screen_height #screen_width
unlock from left to right
<Unlocker name="unlocker">
<StartPoint x="45" y="#screen_height-152" w="82" h="82">
<Image x="45" y="#screen_height-152" src="hs_unlock_button.png">
<EndPoint x="353" y="#screen_height-152" w="82" h="82">
<Image x="353" y="#screen_height-152" src="hs_target.png">
<Path x="0" y="#screen_height-152">
<Position x="45" y="0" />
<Position x="353" y="0" />


If you have any question and suggestion plz contact me through:
I may not check this thread frequently.

-- Ruijun
from MIUI team
Attached Files
File Type: zip TF3 lockscreen - [Click for QR Code] (2.62 MB, 3765 views)
The Following 53 Users Say Thank You to pomenx For This Useful Post: [ View ] Gift pomenx Ad-Free
29th June 2011, 07:19 AM |#2  
h_zee13's Avatar
Senior Member
Flag Montreal
Thanks Meter: 1,131
Donate to Me
Wow this is sick! This will us themers so much.
Thank you for this!
The Following User Says Thank You to h_zee13 For This Useful Post: [ View ] Gift h_zee13 Ad-Free
29th June 2011, 07:24 AM |#3  
Jumba's Avatar
Senior Member
Flag Johannesburg
Thanks Meter: 710
Donate to Me
Awesome! Thank you for this.
29th June 2011, 12:06 PM |#4  
Junior Member
Thanks Meter: 0
I`m currently working on lockscreen theme mod, based on five-points lockscreen theme. It`s easier than i thought and i think it will be great to share some lockscreen when i finish my work

Just in curious, is there any option to make text style BOLD?
29th June 2011, 02:15 PM |#5  
MarkAtHome's Avatar
Senior Member
Flag New Jersey
Thanks Meter: 327
Is there any chance that it can be ported to work on non-MIUI Android ROMs, so the rest of the Android fanbase can enjoy it as well?
29th June 2011, 02:17 PM |#6  
OP Member
Flag Beijing
Thanks Meter: 98
just add the bold attribute, effect in this week's version.
The Following User Says Thank You to pomenx For This Useful Post: [ View ] Gift pomenx Ad-Free
29th June 2011, 05:05 PM |#7  
Junior Member
Thanks Meter: 0
Great! Can`t wait for this week`s version!
29th June 2011, 05:18 PM |#8  
Tijmen's Avatar
Retired Forum Moderator
Flag Rotterdam
Thanks Meter: 2,623
I'm trying to edit some of the shortcuts in my lockscreen. But i can't seem to find which class i have to set. I would like to know the class needed to open the music player and to open my email application, instead of the gmail application. Is there any logic behind this, or is there a way i can find this out per app?

Thanks in advance!
29th June 2011, 11:05 PM |#9  
h_zee13's Avatar
Senior Member
Flag Montreal
Thanks Meter: 1,131
Donate to Me
Quick question:
If I want the unlocker to be a button to be just touched, do I just put my intent code in <Endpoint><ReachedState>HERE</ReachedState></Endpoint>
30th June 2011, 04:48 AM |#10  
OP Member
Flag Beijing
Thanks Meter: 98
newly added:
2.10 updated, customisable lockscreen
each lockscreen mtz could has a config.xml file, this file describes the items which are configurable. the file config.xml comes along with manifest.xml under the advance folder.

you can customise the unlock application for now. and more.

config.xml format:

// root
// config group
// text: the display name of group which shows on the configuration setting UI.
<Group text="Date & Time">

// config items:
//text: display name of an item, which displays on the configuration setting UI
//summary: detailed description of an item
//id: the variable name binds to this config item
//default: default value
a config item will bind its value which would be changed by user on the setting UI to the variable specified by id. the variable can be refered in manifest.xml

// switch
<CheckBox text="" summary="" id="show_date" default="1"/>
// text input
<StringInput text="" summary="" id="date_format" default="k:mm"/>
// text choice
<StringChoice text="" summary="" id="time_format">
//choice items:
<Item value="hh:mm" text="12 hours"/>
<Item value="kk:mm" text="24 hours"/>
//number choice
<NumberChoice text="" summary="" id="">
//choice items
<Item value="0" text="Mode 1"/>
<Item value="1" text="Mode 2"/>
//number input
<NumberInput text="" summary="" id="" default=""/>

// select application shortcut in unlocker, id: the intent id in EndPoint, will set the intent according to the selection.
<AppPicker text="" id=""/>


<Group text="Date & Time">
<CheckBox text="Display date" id="show_date" default="1"/>
<StringInput text="Date format" summary="" id="date_format" default="yyyy/M/d EEEE"/>
<NumberInput text="Date text size" id="text_size_date" default="14"/>
<NumberInput text="Date vertical offset" id="date_position_y" default="0"/>
<Group text="App shortcut">
<AppPicker text="Left unlocker shortcut" id="left_task"/>
<AppPicker text="Right unlocker shortcut" id="right_task"/>

<!-- if const is true, the variable will only evaluate once at the initial time, -->

<Var name="show_date" expression="ifelse(isnull(#show_date),1,#show_date )" type="number" const="true"/>
<Var name="text_size_date" expression="ifelse(isnull(#text_size_date),18,#tex t_size_date)" type="number" const="true"/>
<Var name="date_format" expression="ifelse(isnull(@date_format),'MMMMd日 EEEE', @date_format)" type="string" const="true"/>

<DateTime visibility="#show_date" x="#screen_width/2" y="#screen_height-260+49+#time_panel.actual_h+#unlocker.move_y+#date _position_y" align="center" color="#AAEEEEEE" size="#text_size_date" format="@date_format"/>

<Unlocker name="unlocker" bounceInitSpeed="1000">
<StartPoint x="0" y="#screen_height-275" w="#screen_width/4" h="120">


<EndPoint x="0" y="#screen_height-150" w="#screen_width/4" h="300">
<Intent id="left_task" action="android.intent.action.VIEW" type=""/>

<Unlocker name="unlocker" bounceInitSpeed="1000">
<StartPoint x="#screen_width*3/4" y="#screen_height-275" w="#screen_width/4" h="120">

<EndPoint x="#screen_width*3/4" y="#screen_height-150" w="#screen_width/4" h="300">
<Intent id="right_task" action="android.intent.action.MAIN" type="" category="android.intent.category.DEFAULT"/>

// show the app shortcut name
<Text x="#screen_width/2" y="#screen_height-350" align="center" color="#AAFFFFFF" alpha="255-#unlocker.move_y*255" size="24" textExp="'slide unlock to '+ifelse(isnull('',,'Phone',"/>
2 new elements added <Var> <VarArray> for defining single variable and array

<Var name="" expression="" type="" const=""/>
name: variable name
expression: the expression for this variable note: defining a const string needs a more pair of "'" : expression="'my string'"
type= number/string number variable or string variable default: number
const =true , if const is true, the variable would only calculate once in initiation, if this variable will not change when lockscreen starts runing, set const false can improve performance, if it's changing you should not set it true. default: false

array, index base 0
<VarArray type="string">
<Var name="date_format1" index="#time/2000%5"/>
<Var name="date_format2" index="2" const="true"/>
<Item expression="ifelse(isnull(@date_format),'MMMMd日 EEEE', @date_format)"/>
<Item value="EEEE"/>

type=number/string number array or string array, default: number
Var: the variable binds to this array
index, could be an expression
Item: element in array
expression: the expression of this variable
value: if element is const value, use value to specify

code sample:

<!-- if const is true, the variable will only evaluate once at the initial time, -->
<Var name="show_date" expression="ifelse(isnull(#show_date),1,#show_date )" type="number" const="true"/>
<Var name="text_size_date" expression="ifelse(isnull(#text_size_date),18,#tex t_size_date)" type="number" const="true"/>

<VarArray type="string">
<Var name="date_format1" index="#time/2000%5"/>
<Var name="date_format2" index="2" const="true"/>
<Item expression="ifelse(isnull(@date_format),'MMMMd日 EEEE', @date_format)"/>
<Item value="EEEE"/>
<Item value="yyyy年"/>
<Item value="MMMM"/>
<Item value="d日"/>

<DateTime visibility="#show_date" x="#screen_width/2" y="100" align="center" color="#AAEEEEEE" size="#text_size_date" format="@date_format1"/>

// the datetime show date in different format every 2 seconds.

new attribute for Unlocker: alwaysShow="true/false"
<Unlocker alwaysShow="true">
before if one unlocker is in non normal state, other unlockers will be hide, this brings inconvenience sometime, now you can specify a unlocker show always

expression support strings, concatenate strings or numbers using "+" , isnull can be used to string variable,ifelse can select strings as well, string compare: eqs(@string1, @string2)

Text added textExp attribute which support string expression:
<Text visibility="#hasweather" x="(#screen_width/2)+180" y="#screen_height-290" w="360" size="36" color="#ffffff" alpha="255" align="right"
textExp="ifelse(isnull(#weather_temperature),'--',#weather_lowTemperature) + '℃'"

support formating of “where”
<ContentProviderBinder where="" whereFormat="" whereParas="">

content provider supports dependency, variables acquired after the query of a ContentProviderBinder can be used as the query parameter of another ContentProviderBinder

<ContentProviderBinder name="name1" dependency="name2">
<ContentProviderBinder name="name2" >
after name2 query complete, name1 could use the variables binded in name2 as format parameters. and if the data changes in name2 and triggers the query of name2, it will also trigger the query of name1 after query complete of name2.

support the content provider in android, basically it provides a common interface to query applications' raw database. and the new feature of lockscreen defines a set of xml language for describing how to query the content provider and bind the result to lockscreen variables, so the lockscreen could display any other applications' information as long as it provides a content provider.

xml format:
<ContentProviderBinder uri="content://sample/test" c uriFormat="" uriParas="" columns="col1,col2" where="" args="" order="" countName="count_name">
<Variable name="variable_name1" type="int" column="col1" row="0"/>
<Variable name="variable_name2" type="string" column="col2" row="0"/>

VariableBinders: defines all kinds of variables which bind to a certain source.
ContentProviderBinder: define a content provider and variables bind to it.
uri: content provider uri, specifies which content provider your are selecting.
uriFormat: if the uri needs appending a variable, this can be used together with uriParas
uriParas: just like the Text element's format and paras
columns: what columns you want to query, separate by comma
where: the query condition, same as the SQL
args: arguments for "where", maybe it's not useful for now.
order: order by specification, refer to SQL
countName: bind the query result count to a number variable which has the given name.
Variable: defines a variable
name: variable name
type: the type in database, could be string/double/float/int/long
column: to which column of the result it binds.
row: to which row of the result it binds

for example (code only works in this week's version which is not released yet):
query weather info from google weather.
(check out the attachment "TF3 lockscreen" change zip to mtz)
<!-- content provider binder for google weather -->
columns="iconResId,location,temperature,lowTempera ture,highTemperature,description"
<Variable name="weather_id" type="int" column="iconResId"/>
<Variable name="weather_location" type="string" column="location"/>
<Variable name="weather_temperature" type="int" column="temperature"/>
<Variable name="weather_lowTemperature" type="int" column="lowTemperature"/>
<Variable name="weather_highTemperature" type="int" column="highTemperature"/>
<Variable name="weather_description" type="string" column="description"/>

<!-- weather info display -->
<Text visibility="#hasweather" x="240" y="60" w="360" size="24" color="#FFFFFF" alpha="200" align="center"
format="%s %s %d℃"
paras="@weather_location,@weather_description,#wea ther_temperature" />
<Text visibility="#hasweather*not(isnull(#weather_lowTem perature))*not(isnull(#weather_highTemperature))" x="240" y="85" w="360" size="22" color="#FFFFFF" alpha="200" align="center"
format="%d℃ / %d℃" paras="#weather_lowTemperature,#weather_highTemper ature"/>
<Text visibility="#hasweather*isnull(#weather_lowTempera ture)*not(isnull(#weather_highTemperature))" x="240" y="85" w="360" size="22" color="#FFFFFF" alpha="200" align="center"
format="--℃ / %d℃" paras="#weather_highTemperature"/>
<Text visibility="#hasweather*not(isnull(#weather_lowTem perature))*isnull(#weather_highTemperature)" x="240" y="85" w="360" size="22" color="#FFFFFF" alpha="200" align="center"
format="%d℃ / --℃" paras="#weather_lowTemperature" />

<Image src="weather.png" visibility="#hasweather" x="240" y="100" srcid="#weather_id" align="center">
<Position x="-10" y="0" time="1000"/>
<Position x="10" y="0" time="3000"/>
<Position x="0" y="0" time="4000"/>

// google weather id list
weather_chance_of_rain = 2130837536;
weather_chance_snow = 2130837540;
weather_chance_storm = 2130837544;

weather_clear = 2130837556;
weather_cloudy = 2130837560;

weather_flurries = 2130837564;

weather_fog = 2130837568;

weather_heavy_rain = 2130837572;
weather_icy_sleet = 2130837576;
weather_mist = 2130837583;
weather_partly_cloudy = 2130837587;

weather_rain = 2130837600;
weather_snow_rain = 2130837606;
weather_snow = 2130837608;
weather_sunny = 2130837612;
weather_thunderstorm = 2130837617;
weather_unknown = 2130837621;
weather_windy = 2130837626;

another one:
query the MIUI note content:
<ContentProviderBinder uri="content://notes/note" columns="modified_date,snippet" order="modified_date DESC" countName="note_count">
<Variable name="note_date1" type="long" column="modified_date" row="0"/>
<Variable name="note_snippet1" type="string" column="snippet" row="0"/>

<DateTime x="300" y="50" color="#ffffffff" visibility="#note_count" value="#note_date1" format="yyyy年MMMMdd日 hh:mm"/>
<Text x="5" y="180" w="450" color="#ffffffff" visibility="#note_count" size="18" marqueeSpeed="60" text="@note_snippet1"/>

the missed call query:
columns = "_id,number"
where = "type=3 AND new=1";
uri ="content://call_log/calls";

you can display the call number in lockscreen and the date or anything else.

and added several functions for expression:
eq(x, y) // x==y ? 1 : 0
ne(x, y) // x!=y ? 1 : 0
ge(x, y) // x>=y ? 1 : 0
gt(x, y) // x>y ? 1 : 0
le(x, y) // x<=y ? 1 : 0
lt(x, y) // x<y ? 1 : 0

isnull(x) // x==null ? 1 : 0 // whether the expression contains a null variable. usually for binded variables, to judge whether the value in database is null.
not(x) x>0 ? 0 : 1
ifelse(x, y, z) // x>0 ? y : z

1. using images to display a number
<ImageNumber number="" src="">
number: the expression of number value
src: the image name, supports SourceAnimation
if src="number.png" it will use number_0.png number_1.png ... images to draw the number, kinda like the Time
2. #time_sys variable, the current system time in miliseconds
Attached Files
File Type: zip TF3 lockscreen - [Click for QR Code] (2.62 MB, 2381 views)
The Following 7 Users Say Thank You to pomenx For This Useful Post: [ View ] Gift pomenx Ad-Free
30th June 2011, 04:52 AM |#11  
OP Member
Flag Beijing
Thanks Meter: 98
Originally Posted by h_zee13

Quick question:
If I want the unlocker to be a button to be just touched, do I just put my intent code in <Endpoint><ReachedState>HERE</ReachedState></Endpoint>

put the button element in <Endpoint><PressedState>HERE</PressedState></Endpoint>
if you want the button stays there you just put it in Endpoint, if you want it follows your finger when dragging put it in Startpoint.
Post Reply Subscribe to Thread

lockscreen, miui

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes