Automatically change Wallpaper - Tasker Tips & Tricks

Here is a video I made explaining how to automatically change wallpaper on android with tasker.
https:// + youtu.be + /C7eazbrOBK4 (I can't post links since I'm a new user )
Steps:
1. Copy all photos into one folder.
2. Batch rename them to be in some order (eg: w_0.jpg, w_1.jpg, w_2.jpg, ... etc.). This can be done with solid explorer or es file explorer.
3. Open Tasker and select new task. Name it "Auto Wallpaper" or any other name you want.
4. Click on "+" and search for "Variable randomise" an select it. Set variable as "%Num", min to whatever your minimum value is "0" and max to the number on the last wallpaper. i.e if the last one says "w_36.jpg" set max to 36.
5. Go back and click on plus again. This time search for wallpaper and select "Set Wallpaper". For the file link click on the search button on top of it and browse and select one of the photos in the wallpaper folder.
6. The path will be something like "/downloads/wallpapers/w_0.jpg" . Replace the number with "%Num" (i.e "w_0.jpg" -> "w_%Num.jpg"). Also tick "Scale" and "Crop"
7. We are done with the task and now it's time to make a profile. Go to profile tab and click on "+" and create a new time based profile. Give the time when you want this profile to be active and then select "Repeat" and set the interval you want to change the wallpapers.
8. That's it! You're done. Enjoy!

How do we at stop some of the photos going on there side.
Sent from my SM-G930F using XDA-Developers Legacy app

Josh Smith10 said:
How do we at stop some of the photos going on there side.
Sent from my SM-G930F using XDA-Developers Legacy app
Click to expand...
Click to collapse
Ticking both scale and crop is the best thing you can do. I tried to see if there will be any difference if I normally apply it from gallery, but it gave the same result. I think it is the default behaviour. I kinda liked it so left it as it is.
At the end of the day, I'm not really sure. If anyone can figure it out it'll help. I'll try and see what I can do.

I made a profile that does that a while ago and redesigned it yesterday.
Change the directories to your liking.
They also look for new wallpapers in a subfolder (.toadd) and rename them automatically.

I had made an improvised version of the task by using the list files option giving output variable array %files and setting the max value as the length of the array obtained in the previous action("%files(#)") as the maximum value in the randomizer which outputs a variable %rand . Then set a varialble %wall to %files(%rand) and set wallpaper to %wall. Doesn't require me to change the name of the picture or update the max value whenever I add a picture.

Hrishikesh Patil said:
I had made an improvised version of the task by using the list files option giving output variable array %files and setting the max value as the length of the array obtained in the previous action("%files(#)") as the maximum value in the randomizer which outputs a variable %rand . Then set a varialble %wall to %files(%rand) and set wallpaper to %wall. Doesn't require me to change the name of the picture or update the max value whenever I add a picture.
Click to expand...
Click to collapse
Can you share task XML file please? I couldn't get it to work.
Vagelis1608 said:
I made a profile that does that a while ago and redesigned it yesterday.
Change the directories to your liking.
They also look for new wallpapers in a subfolder (.toadd) and rename them automatically.
Click to expand...
Click to collapse
Not working
elPsyCongroob said:
Here is a video I made explaining how to automatically change wallpaper on android with tasker.
https:// + youtu.be + /C7eazbrOBK4 (I can't post links since I'm a new user )
Steps:
1. Copy all photos into one folder.
2. Batch rename them to be in some order (eg: w_0.jpg, w_1.jpg, w_2.jpg, ... etc.). This can be done with solid explorer or es file explorer.
3. Open Tasker and select new task. Name it "Auto Wallpaper" or any other name you want.
4. Click on "+" and search for "Variable randomise" an select it. Set variable as "%Num", min to whatever your minimum value is "0" and max to the number on the last wallpaper. i.e if the last one says "w_36.jpg" set max to 36.
5. Go back and click on plus again. This time search for wallpaper and select "Set Wallpaper". For the file link click on the search button on top of it and browse and select one of the photos in the wallpaper folder.
6. The path will be something like "/downloads/wallpapers/w_0.jpg" . Replace the number with "%Num" (i.e "w_0.jpg" -> "w_%Num.jpg"). Also tick "Scale" and "Crop"
7. We are done with the task and now it's time to make a profile. Go to profile tab and click on "+" and create a new time based profile. Give the time when you want this profile to be active and then select "Repeat" and set the interval you want to change the wallpapers.
8. That's it! You're done. Enjoy!
Click to expand...
Click to collapse
Using your task, I have to change the file name and max number in Variable Randomize action every time I add a new file to my wallpapers folder.
this task, it doesn't have above drawback. But it changes only home-screen wallpaper and I can't set it to lock-screen or both.
Do you know how to do that?
EDIT: Found it! https://www.abhisek.info/blog/tasker-profile-random-wallpapers/

xml of working task
Thanks to Hrishikesh Patil and topic starter. I just add condition to grab from selected folder only jpg and png due to Tasker precondition.
Code:
<TaskerData sr="" dvi="1" tv="5.7.1">
<Task sr="task35">
<cdate>1560531444701</cdate>
<edate>1560793115421</edate>
<id>35</id>
<nme>RandWallpaper2</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>412</code>
<label>=== Проверено на Nova launcher (функция Wallpaper scrolling тоже работает) ===
Загружаем список всех картинок jpg и png (в массив)</label>
<Str sr="arg0" ve="3">/storage/8831-0XXX/DCIM/Wallpapers</Str>
<Str sr="arg1" ve="3">*.jpg/*.png</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3">%mwfilelist</Str>
</Action>
<Action sr="act1" ve="7">
<code>547</code>
<label>Кол-во картинок</label>
<Str sr="arg0" ve="3">%mmax</Str>
<Str sr="arg1" ve="3">%mwfilelist(#)</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act2" ve="7">
<code>545</code>
<label>Случайный индекс</label>
<Str sr="arg0" ve="3">%mrand</Str>
<Int sr="arg1" val="1"/>
<Int sr="arg2">
<var>%mmax</var>
</Int>
</Action>
<Action sr="act3" ve="7">
<code>547</code>
<label>Имя файла случайной картинки</label>
<Str sr="arg0" ve="3">%mfile_name</Str>
<Str sr="arg1" ve="3">%mwfilelist(%mrand)</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act4" ve="7">
<code>109</code>
<label>Меняем обои (scale и crop никак не влияли)</label>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3">%mfile_name</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
</Task>
</TaskerData>
I couldn't upload as file only as text.

elPsyCongroob said:
Here is a video I made explaining how to automatically change wallpaper on android with tasker.
https:// + youtu.be + /C7eazbrOBK4 (I can't post links since I'm a new user )
Steps:
1. Copy all photos into one folder.
2. Batch rename them to be in some order (eg: w_0.jpg, w_1.jpg, w_2.jpg, ... etc.). This can be done with solid explorer or es file explorer.
3. Open Tasker and select new task. Name it "Auto Wallpaper" or any other name you want.
4. Click on "+" and search for "Variable randomise" an select it. Set variable as "%Num", min to whatever your minimum value is "0" and max to the number on the last wallpaper. i.e if the last one says "w_36.jpg" set max to 36.
5. Go back and click on plus again. This time search for wallpaper and select "Set Wallpaper". For the file link click on the search button on top of it and browse and select one of the photos in the wallpaper folder.
6. The path will be something like "/downloads/wallpapers/w_0.jpg" . Replace the number with "%Num" (i.e "w_0.jpg" -> "w_%Num.jpg"). Also tick "Scale" and "Crop"
7. We are done with the task and now it's time to make a profile. Go to profile tab and click on "+" and create a new time based profile. Give the time when you want this profile to be active and then select "Repeat" and set the interval you want to change the wallpapers.
8. That's it! You're done. Enjoy!
Click to expand...
Click to collapse
There is no set wallpaper in tasker. Did they remove it, or is it hidden somewhere. Tasker android 1l0, 2021.

Related

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

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:
6.26.2012
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
http://forum.xda-developers.com/showpost.php?p=27299135&postcount=6692
------------ 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"/>
</FramerateController>
refer to the builtin default theme for real code.
------------ above is only for MIUI v4 ---------------
lockscreen on 2.3 will not update.
2.0:
http://forum.xda-developers.com/showpost.php?p=15211258&postcount=10
12.5
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.
11.24
content provider support
logic functions and select function
a new component which uses image to display a given number
http://forum.xda-developers.com/showpost.php?p=15211258&postcount=10
---------------------------------------------
10.21
unlocker bounce animation when released.
sample:
<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" .../>
#tt.text_width
the actual position variables of an element, acquire the position in animation. actual_x actual_y
<Image name="img" ... >
<ositionAnimation>
...
</PositionAnimation>
</Image>
#img.actual_x #img.actual_y
9.30
support formatting of string variable
<Text format="Next alarm:[%s] Battery:[%d%%]" paras="@next_alarm_time,#battery_level"/>
text and date rotation <Text angle=""/>
9.23
support string variable .
next_alarm_time
<Text text="@next_alarm_time" .../>
9.2
* Text/DateTime support rotation now.
8.26
* 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
8/12:
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">
7/15:
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
Sample:
<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: name.property 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
minute:
second:
year:
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
Sample:
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.
7.
8. other animations:
9. <RotationAnimation>
10. <Rotation angle="" time=""/>
11. <Rotation angle="" time=""/>
12. </RotationAnimation>
13.
14. <SizeAnimation>
15. <Size w="" h="" time=""/>
16. <Size w="" h="" time=""/>
17. </SizeAnimation>
18.
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
Sample:
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
size:
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>
Sample:
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
MMM Sep
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. name.property
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>
8.
9. <!-- show the target position if pressed trying to unlock-->
10. <PressedState>
11. <Image/>
12.
13. </PressedState>
14.
15. <!-- show specified image when reached target, if touch up then perform unlock-->
16. <ReachedState>
17. <Image/>
18. </ReachedState>
19.
20.
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.
<EndPoint/>
</Unlocker>
Sample:
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.
<Wallpaper/>
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"/>
</MusicControl>
Sample:
<!-- double click to show or hide the music control -->
<Button x="178" y="529" w="126" h="126">
<Triggers>
<Trigger action="double" target="music_control" property="visibility" value="toggle"/>
</Triggers>
</Button>
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>
-------------------------
---TIPS
1.
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),
code:
<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">
<NormalState>
<Image x="45" y="#screen_height-152" src="hs_unlock_button.png">
</Image>
</NormalState>
</StartPoint>
<EndPoint x="353" y="#screen_height-152" w="82" h="82">
<NormalState>
<Image x="353" y="#screen_height-152" src="hs_target.png">
</Image>
</NormalState>
<Path x="0" y="#screen_height-152">
<Position x="45" y="0" />
<Position x="353" y="0" />
</Path>
</EndPoint>
</Unlocker>
=================================================
If you have any question and suggestion plz contact me through: xuruijun#.xiaomi.com
I may not check this thread frequently.
Thanks
-- Ruijun
from MIUI team
Wow this is sick! This will us themers so much.
Thank you for this!
Awesome! Thank you for this.
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?
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?
just add the bold attribute, effect in this week's version.
Great! Can`t wait for this week`s version!
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!
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>
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>
// config group
// text: the display name of group which shows on the configuration setting UI.
e.g.
<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"/>
</StringChoice>
//number choice
<NumberChoice text="" summary="" id="">
//choice items
<Item value="0" text="Mode 1"/>
<Item value="1" text="Mode 2"/>
</NumberChoice>
//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=""/>
sample:
config.xml
<Config>
<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>
<Group text="App shortcut">
<AppPicker text="Left unlocker shortcut" id="left_task"/>
<AppPicker text="Right unlocker shortcut" id="right_task"/>
</Group>
</Config>
manifest.xml
<!-- 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,#text_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">
</StartPoint>
<EndPoint x="0" y="#screen_height-150" w="#screen_width/4" h="300">
<Intent id="left_task" action="android.intent.action.VIEW" type="vnd.android.cursor.dir/calls"/>
</EndPoint>
</Unlocker>
<Unlocker name="unlocker" bounceInitSpeed="1000">
<StartPoint x="#screen_width*3/4" y="#screen_height-275" w="#screen_width/4" h="120">
</StartPoint>
<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="vnd.android-dir/mms-sms" category="android.intent.category.DEFAULT"/>
</EndPoint>
</Unlocker>
// 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(@right_task.name)+eqs('',@left_task.name),'Phone',@left_task.name)"/>
1.7
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">
<Vars>
<Var name="date_format1" index="#time/2000%5"/>
<Var name="date_format2" index="2" const="true"/>
...
</Vars>
<Items>
<Item expression="ifelse(isnull(@date_format),'MMMMd日 EEEE', @date_format)"/>
<Item value="EEEE"/>
...
</Items>
</VarArray>
type=number/string number array or string array, default: number
Var: the variable binds to this array
name
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">
<Vars>
<Var name="date_format1" index="#time/2000%5"/>
<Var name="date_format2" index="2" const="true"/>
</Vars>
<Items>
<Item expression="ifelse(isnull(@date_format),'MMMMd日 EEEE', @date_format)"/>
<Item value="EEEE"/>
<Item value="yyyy年"/>
<Item value="MMMM"/>
<Item value="d日"/>
</Items>
</VarArray>
<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
12.16
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:
example:
<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) + '℃'"
alpha="255-#unlocker.state*255"/>
12.5
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.
11.24
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:
<VariableBinders>
<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"/>
</ContentProviderBinder>
</VariableBinders>
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 weather.zip" change zip to mtz)
<!-- content provider binder for google weather -->
<VariableBinders>
<ContentProviderBinder
uriFormat="content://com.google.android.apps.genie.geniewidget.weather/weather/current/%d"
uriParas="#time_sys"
columns="iconResId,location,temperature,lowTemperature,highTemperature,description"
countName="hasweather">
<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"/>
</ContentProviderBinder>
</VariableBinders>
<!-- 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,#weather_temperature" />
<Text visibility="#hasweather*not(isnull(#weather_lowTemperature))*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_highTemperature"/>
<Text visibility="#hasweather*isnull(#weather_lowTemperature)*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_lowTemperature))*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">
<PositionAnimation>
<Position x="-10" y="0" time="1000"/>
<Position x="10" y="0" time="3000"/>
<Position x="0" y="0" time="4000"/>
</PositionAnimation>
</Image>
// 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:
<VariableBinders>
<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"/>
</ContentProviderBinder>
</VariableBinders>
<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
others:
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
h_zee13 said:
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>
Click to expand...
Click to collapse
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.
Does anyone know if it's possible to launch Google's music player from the lock screen?
Thanks!
Hi
Thank you for all this explanations ..
Excuse for my bad english
@+ Max
How do I know, what I have to write under "package". I need it for whatsapp and Dolphin Browser HD.
Thanks,
Jaques-Ludwig
Jaques-Ludwig said:
How do I know, what I have to write under "package". I need it for whatsapp and Dolphin Browser HD.
Thanks,
Jaques-Ludwig
Click to expand...
Click to collapse
check this thread:
http://forum.xda-developers.com/showthread.php?t=1134657
battery_level seems to update only when phone is charging otherwise remains constant is this a bug or am I coding it incorrectly i used following to
<Text x= "200" y = "0" text="Battery : " color = "#AAFFFFFF" size="18" format = "%d %%" paras = "#battery_level" align = "center"/>
works fine when charging but remains at same value when not.
Nice, great tut!
smokin901 said:
battery_level seems to update only when phone is charging otherwise remains constant is this a bug or am I coding it incorrectly i used following to
<Text x= "200" y = "0" text="Battery : " color = "#AAFFFFFF" size="18" format = "%d %%" paras = "#battery_level" align = "center"/>
works fine when charging but remains at same value when not.
Click to expand...
Click to collapse
for now I can only get the battery info notification when plugged, will figure out how to update it always.
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.
<Wallpaper/>
Click to expand...
Click to collapse
Can you please explain this further.
What do you mean by "A Lockscreen may have multiple Wallpaper element"
Also can I put any code before </wallpaper>?
h_zee13 said:
Can you please explain this further.
What do you mean by "A Lockscreen may have multiple Wallpaper element"
Also can I put any code before </wallpaper>?
Click to expand...
Click to collapse
Wallpaper element is just like a normal Image, the only difference is that it refers to the system wallpaper bitmap. so you can put it anywhere and put any count of it. It can be used to achieve the effect that dragging the wallpaper away to unlock, like WP7. and you can also make the wallpaper dissapear gradually when unlocking, or make the wallpaper split at middle and fly to left and right when unlocking by adding maskes to two Wallpaper elements. etc.
so, yes you can put anything before Wallpaper

[GUIDE]Vector and QS icons edit

Hello everyone !
This is my first tutorial in xda forums ! i hope you will find it useful
First of all my english is not good enough so please be patient!
Some words about tutorial:
This tutorial will explain what is a "vector",how can this be useful on android theming,how to use it.
I am not here to teach you,i am here to guide you to the solution you want to find
I am also a newbie on themes so please be soft with me
Lets start!
Describing "vector" with some simple words ,vector is a loseless-quality picture.By the word "loseless" i mean that the quality of the picture will not
be destroyed even if i maximize it 20000 pixels more!...
-Wow Side that means that i can edit all my photos to be perfect quality!
-No,of course no!...Vectoring a picture is not an easy operation.Needs a plenty of time and patience...You will see that it is not as easy as it seems
On this tutorial i will present to you how to create and edit vectors of QS icons.
-Why shouldnt i use pngs instead of vectoring?
-If you are boring of programming a vector,then just use pngs.i prefer all icons to be vector because its easier on animations,you dont fill your theme with
pngs,etc etc...its absolutelly your own choise
Lets start.........again
First of all lets explain how the things will work,theoritically and then we will proceed to actions
Lets imagine vector programming as a robot-arm which moves the way you program it.It uses some coordinates on a "canvas" we will define.
So,just think about a surface which u look at it from the top.
This surface has got some coordinates ,as we said.
Look at this picture http://prntscr.com/6yu7mg
As we can see ,the surface has got 2 dimensions...X and Y as the arrows are showing.
Firstly we have to know the coordinates of "the start" of the surface.Android uses point (0,0) on top left.
so the maximum coordinates will be at bottom right ( http://prntscr.com/6yu91r )
Lets say that the maximum coordinates are X=100 and Y=100 and we want to move our robot-arm on some points...
hm...lets make a square with 20x20 dimensions ...(we suppose that the move command is "Move x,y" )
The code will be have 4 times the command "move" with the 4 corner points of the square.
so,it will be
Code:
move 0,20
move 20,20
move 0,20
move 0,0
This will be the output ( http://prntscr.com/6yudg7 )
So this is how we will work on vector creation !
Before we continue i would like to point something...
In the previous problem we used ABSOLUTE coordinates.Absolute coordinates means that the number is the actual coordinate of the surface.
In this point we have to mention for RELATIVE coordinates.Relative coordinates means ,that the number shows the new position SINCE THE LAST ONE.
example
absolute coordinates problem:
move 0,20
move 20,0
output will be http://prntscr.com/6yugct
Relative coordinates problem will be:
move 0,20
move 20,20
that means "FROM THE LAST POINT YOU ARE,GO +20 TO X AND +20 TO Y"
Sometimes we need both techniques
lets move on actual situations!
SVG stands for (Scalable Vector Graphics)
First of all we will need some tools.
A powerful text editor,i prefer notepad++ Here
GIMP program (its a freeware) And here (NOT USED FOR NOW)
1 useful website http://apps.pixlr.com/editor/ or just an image editor of your choise(I use this its simple,light and i install nothing) (NOT USED FOR NOW)
The android API website and here
A reference on how SVG is built ...and here
Google's SVG editor here too (NOT USED FOR NOW)
Brain
Fantasy
and patience
So lets make a try to build a simple square icon for QS icons with one line from topleft to bottomright.
We will replace bluetooth icon when its off....on cm12.1 its ic_qs_bluetooth_off.xml
Opening it with notepad++ we are checking many things...JUST DELETE THEM...we will build it from the scratch ,step by step
First of all,before we start,we open in our browser those links:
https://developer.android.com/training/material/drawables.html
http://www.w3.org/TR/SVG11/paths.html
https://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html
So,lets start building.
The first line of our xml will be of course
Code:
<?xml version="1.0" encoding="utf-8"?>
The item we will add is called simply "vector"
so we add this code
Code:
<vector
</vector>
Inside this quote ,will be our code.Lets see what google says about "vectors" ( Link here! )
As we can see on this website,we now declare the name of our surface,the size etc.
So as Google says the android:height and width affect the WHOLE surface
but viewportHeight and width affects only the working area!
So lets add to our code:
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="64.0dip" android:width="64.0dip"
android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">
</vector>
So our surface will be 64.0 dip and the place where we will draw will be 64 too(That means we need all the surface )
Scrolling on the website we see "group"...Group is used for multiple drawing in ONE surface.
Example: if we need to draw 1 circle and 1 triangle we will use group for those 2 drawings
In our tutorial we will draw a rectangular and a line from topleft to botton right with 2 different colors.
We need 2 drawing so we will add group to our code as it is on the website.
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="64.0dip" android:width="64.0dip"
android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:name="line">
</group>
<group android:name="square">
</group>
</vector>
After that we must add the "PATH".
'Path in SVG means a sentence of commands which are actually our commands
So we add the <path </path> in our code.
Now its time to add the color of the pencil we want to use.Lets say red for square and green for line.
as we can see the website the pencil color and width is:
android:strokeColor and
android:strokeWidth
BE CAREFUL! strokeColor means color of the pencil we are drawing.fillColor is the color which we want a closed-area to be colored with
Lets add them to our code with path too
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="64.0dip" android:width="64.0dip"
android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:name="base_gauge">
<path
android:strokeColor="#55ff55"
/>
</group>
<group android:name="square">
<path
android:strokeColor="#ff5555"
android:strokeWidth="4.0"
/>
</group>
</vector>
Now get ready for the final step.We know have to write down the commands we want .
Lets move to that website ( Here )
This is the reference of the SVG...Scrolling down we see many commands ...We will need Moveto, Lineto and ClosePath on this tutorial.
As we see the Moveto command it is compiled as "M or m (absolute or relative coordinates as we saw before) following by the coordinates)"
Same thing goes for Lineto.
As google says the class element that contains the commands is ''android: pathData''
Lets add some code for the line! !
IN DEPTH,EXPLANATION OF pathData and commands
As we see pathData is an element which contains a string .This string is the command line of the movement we want.
pathData is the most important element of vector class.
Watching on SVG reference we can understand that ,to create many lines we dont have to write 'L' 'L' 'L' 'L' 'L' again and again.
If we need to draw same shape ,many time we just add the coords of next point to go.
example:
m 0,0 30,12 140,124 -23,25
but here ,we have to watch something serious...everytime the commands "checks" for other parametre,it has to know the previous point!
So if we want to go 140,124 ,the commands MUST know the previous point(which is 30,12).
Many people use lowercase commands(for relative)...It seems to work better..its all about your feeling.Try both with care.
if we firstly use relative coordinates and then absolute,we must understand WHICH is the first and last point!.This is the difficult part of vectoring.
The website with SVG reference ,is writing the general way to use SVGs on computers.ITS NOT ANDROID DETICATED
We can ONLY use what the class contains!!!(Only what the google's website is giving us)
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="64.0dip" android:width="64.0dip"
android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:name="base_gauge">
<path
android:strokeColor="#55ff55" <!--green-->
android:pathData="M0,0 l64,64 z" <!-- this line moves the point to 0,0 and then using relative coordinates,creates a line from 0,0(last used) to +64,+64 -->
/>
</group>
<group android:name="square">
<path
android:strokeColor="#ff5555" <!--red-->
android:strokeWidth="4.0"
/>
</group>
</vector>
using 'z' at the end of command,makes vector enclose the vector and make it seems like 1 object-layer.
try make some test with and without 'z'
Our line is ready!!
Lets see the rectangular..its going to be harder but calm down
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="64.0dip" android:width="64.0dip"
android:viewportWidth="64.0" android:viewportHeight="64.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:name="base_gauge">
<path
android:strokeColor="#55ff55"
android:pathData="M0,0 l64,64 z"
/>
</group>
<group android:name="square">
<path
android:strokeColor="#ff5555"
android:strokeWidth="4.0"
android:pathData=
"M0,0 <!-- start from 0,0-->
l64,0 <!-- create line from 0,0(last used) to +64X and 0 Y -->
0,64 <!--create line from 64,0 (last used) to +0X and +64Y (We see that the new point is 64,64 but there is nowhere "64,64" ;) ) -->
-64,0 <!-- create line from last used to -64X and +0Y ( '-' means GO LEFT for X and UP for Y) -->
0,64
z"
/>
</group>
</vector>
The code is ready
This will be the output http://prntscr.com/6yv6s3
As this code works,almost all the vectors in android works like this
Thanks for reading! I will add the way to convert pngs to vector codes soon !Edits will be done every time i think something has to be added!
The tutorial is not finished.Some tools i posted are not used anywhere for now Please be patient!
Thanks again!
TIP:
See how CM developers have created the icons on QS now,it doesnt seem so Greek to you,isnt it ?​
Convert PNG to vector pathdata​
In this post we will see how to convert a PNG icon to vector path..
Some words before proceed....
Converting PNG to vector is not always successfull on each operation.
We will see a "fast" way to do that but this way doesnt promise a 100% result...
The result may differ from original png...Automated ways are always not so trusted as manual.
So,first of all lets select the png we want to convert....I will choose the flight mode icon from S5 TouchWiz(it is attached)
Run GIMP and for loading...3 windows will propably pop up.
Drag and drop the png to GIMP
You should see something like this( This
Now go to Toolbox and select the magic wand tool (It is called Fuzzy Select Tool).its the 4th icon of 1st row.
now,press ctrl+a to select ALL the icon
Go to 'Select' option and select 'Invert' ( Like this )
Then select the Fuzzy Select Tool again and select the area you want to be vectored.
We press on the circle around the airplane( This one )
Press again "Select" and press on "To path"
Now look on top right ,on the window called "Layers - Brushes"
and press the third icon .
Now the window is called "Paths-Brushes" and we can see the airplane icon modified.Press right click on it and select "Export Path"
( Link)
Select the Desktop icon as destination and give that vector a name
Once it is done,you will see a file created to desktop,with no extension.
Right click on it and open it with notepad ++
In the file we can clearly see the path of the file ( Like this )
Copy all that pathdata to clipboard...
Now open the SVG editor u have already downloaded.extract and open the contained folder..You will many files there...Just run the file svg-editor.html
This will open the svg editor to your browser.Click on topleft button with SVG letters,spot the d="" and paste there the pathdata we got from notepad++
Be careful
Ensure the dimensions of width and height to be setted on SVG code...or else the vector will be outside of the bounds.
DONT RESIZE THE VECTOR ON SVG EDITOR.
Svg editor is used only for presentation.
The code we copied to clipboard will be used on .xml file.
SVG editor changes all the coordinates from absolute to relative.dont copy that code there.
Vector pathdata is now ready! just the use the preferred colors as we saw at post 1
Thanks a lot ! ​
reserved just in case
added png to vector conversion at post #2!
Just a bump.will lock soon.doesnt seem to care anyone :/
Thank you for this tutorial, it's really interesting!! I'm trying to convert some PNGs to xml because I want to add a background to the quicksettings tiles, I made a colored circle with shades, I opened it in Gimp and followed all the steps in the tutorial but when I open the final svg I see a black square...I don't understand why..
EDIT: after some tests it works, the only problem is how to center the circle behind the tiles..
EDIT2: translate command, but not easy to use it, several tests to find the right position..
mikethevalar said:
Thank you for this tutorial, it's really interesting!! I'm trying to convert some PNGs to xml because I want to add a background to the quicksettings tiles, I made a colored circle with shades, I opened it in Gimp and followed all the steps in the tutorial but when I open the final svg I see a black square...I don't understand why..
EDIT: after some tests it works, the only problem is how to center the circle behind the tiles..
EDIT2: translate command, but not easy to use it, several tests to find the right position..
Click to expand...
Click to collapse
thanks for reply
the color of the vector is changed INSIDE the xmls .you declare it as fillcolor. read the tutorial again.
side said:
thanks for reply
the color of the vector is changed INSIDE the xmls .you declare it as fillcolor. read the tutorial again.
Click to expand...
Click to collapse
Yea that is in the xml, in the svg the code is *fill="coloryouwant"*. Thank you again.
---------- Post added at 03:13 PM ---------- Previous post was at 03:10 PM ----------
Unfortunatly the creation of a vector drawable from 0 is very tedious if the shape is not a square, the simplest way is to convert an already made png
mikethevalar said:
Yea that is in the xml, in the svg the code is *fill="coloryouwant"*. Thank you again.
---------- Post added at 03:13 PM ---------- Previous post was at 03:10 PM ----------
Unfortunatly the creation of a vector drawable from 0 is very tedious if the shape is not a square, the simplest way is to convert an already made png
Click to expand...
Click to collapse
yes...as i said on post #1 ,the result may differ...its all about our skills
side said:
yes...as i said on post #1 ,the result may differ...its all about our skills
Click to expand...
Click to collapse
I'm trying to understand how to apply shades in the xml. I found that we can use the "path shade" code with different types of shade like linear, radial, etc.. But I can't find a good guide to these commands...
mikethevalar said:
I'm trying to understand how to apply shades in the xml. I found that we can use the "path shade" code with different types of shade like linear, radial, etc.. But I can't find a good guide to these commands...
Click to expand...
Click to collapse
neither do i :/ ... i have never used shades on vectors just shapes
side said:
neither do i :/ ... i have never used shades on vectors just shapes
Click to expand...
Click to collapse
Unfortunately it seems that it's not possible, drawable vectors do not support gradients, so we can't fill a vector path with a color shade . I read it here
mikethevalar said:
Unfortunately it seems that it's not possible, drawable vectors do not support gradients, so we can't fill a vector path with a color shade . I read it here
Click to expand...
Click to collapse
MMMMMMMMMM yes ...not problem though ...i never needed it SO much!
side said:
MMMMMMMMMM
Click to expand...
Click to collapse
I've few questions, my image (in attached part, I made it a little more visual to see well) has 4 parts, so I magine that I'll have 4 "pathData" lines?! For that, I decomposed the images in 4 parts.
Here the results:
First part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection"
fill="none" stroke="black" stroke-width="1"
d="M 41.77,19.00
C 41.77,19.00 21.00,40.00 21.00,40.00
18.43,42.57 13.26,48.31 10.00,49.38
4.52,51.18 0.59,45.66 5.43,39.00
5.43,39.00 22.00,22.00 22.00,22.00
26.62,17.38 31.17,11.77 37.00,8.74
45.66,6.94 46.49,13.23 41.77,19.00 Z" />
</svg>
Second part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection #1"
fill="none" stroke="black" stroke-width="1"
d="M 62.69,18.00
C 62.69,18.00 42.00,39.00 42.00,39.00
39.55,41.45 33.78,47.63 31.00,48.97
25.46,51.65 20.35,46.64 25.31,40.00
25.31,40.00 40.00,25.00 40.00,25.00
44.85,20.15 51.54,12.65 57.00,9.03
64.47,6.78 66.89,12.38 62.69,18.00 Z" />
</svg>
Third part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection #2"
fill="none" stroke="black" stroke-width="1"
d="M 83.40,16.00
C 82.17,19.34 77.58,23.42 75.00,26.00
75.00,26.00 59.00,42.00 59.00,42.00
56.05,44.94 49.22,53.02 44.60,48.40
40.23,44.03 47.17,37.85 50.00,35.00
50.00,35.00 67.00,18.00 67.00,18.00
73.36,11.64 74.71,8.12 84.00,8.00
84.00,10.27 84.16,13.93 83.40,16.00 Z" />
</svg>
Fourth part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection #3"
fill="none" stroke="black" stroke-width="1"
d="M 83.40,36.00
C 82.20,39.33 74.18,47.44 71.00,48.97
65.77,51.50 61.50,47.23 64.03,42.00
65.88,38.16 73.38,31.43 77.00,29.03
82.75,27.28 85.44,30.36 83.40,36.00 Z" />
</svg>
To convert it in a good Android xml, I think it should be modified like that ( it's only an example, just that you see I understood, I think)
Example of result possible:
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="23,996992dip" android:width="37,32864dip" android:autoMirrored="true" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@*common:color/theme_dark_side_green_color" android:pathData="M19.700001,20.000000l2.000000,0.000000l0.000000,2.000000l-2.000000,0.000000z" />
<path android:fillColor="@*common:color/theme_dark_side_green_color" android:pathData="M19.700001,10.000000l2.000000,0.000000l0.000000,8.100000l-2.000000,0.000000z" />
<path android:fillColor="@*common:color/theme_dark_side_QS_icon_color_disabled" android:pathData="M17.700001,8.000000l4.299999,0.000000 0.000000,-6.000000 -20.000000,20.000000 15.700001,0.000000z" />
</vector>
In this synthax, my only issue will be perhaps the size, on the files makes by Gimp, the size is in Inch, so I have to convert it too...
Like that:
For xxhdpi (what I mainly use in the theme):
1 inch = 96 pixel
1dp = 3 pixel
ldpi 48.00dp = 36.00px = 0.30in
mdpi 48.00dp = 48.00px = 0.30in
tvdpi 48.00dp = 63.90px = 0.30in
hdpi 48.00dp = 72.00px = 0.30in
xhdpi 48.00dp = 96.00px = 0.30in
xxhdpi 48.00dp = 144.00px= 0.30in
xxxhdpi 48.00dp = 192.00px= 0.30in
Can you confirm and make me a model of that?
franzyroy said:
I've few questions, my image (in attached part, I made it a little more visual to see well) has 4 parts, so I magine that I'll have 4 "pathData" lines?! For that, I decomposed the images in 4 parts.
Here the results:
First part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection"
fill="none" stroke="black" stroke-width="1"
d="M 41.77,19.00
C 41.77,19.00 21.00,40.00 21.00,40.00
18.43,42.57 13.26,48.31 10.00,49.38
4.52,51.18 0.59,45.66 5.43,39.00
5.43,39.00 22.00,22.00 22.00,22.00
26.62,17.38 31.17,11.77 37.00,8.74
45.66,6.94 46.49,13.23 41.77,19.00 Z" />
</svg>
Second part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection #1"
fill="none" stroke="black" stroke-width="1"
d="M 62.69,18.00
C 62.69,18.00 42.00,39.00 42.00,39.00
39.55,41.45 33.78,47.63 31.00,48.97
25.46,51.65 20.35,46.64 25.31,40.00
25.31,40.00 40.00,25.00 40.00,25.00
44.85,20.15 51.54,12.65 57.00,9.03
64.47,6.78 66.89,12.38 62.69,18.00 Z" />
</svg>
Third part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection #2"
fill="none" stroke="black" stroke-width="1"
d="M 83.40,16.00
C 82.17,19.34 77.58,23.42 75.00,26.00
75.00,26.00 59.00,42.00 59.00,42.00
56.05,44.94 49.22,53.02 44.60,48.40
40.23,44.03 47.17,37.85 50.00,35.00
50.00,35.00 67.00,18.00 67.00,18.00
73.36,11.64 74.71,8.12 84.00,8.00
84.00,10.27 84.16,13.93 83.40,16.00 Z" />
</svg>
Fourth part:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
width="1.16652in" height="0.749906in"
viewBox="0 0 84 54">
<path id="Sélection #3"
fill="none" stroke="black" stroke-width="1"
d="M 83.40,36.00
C 82.20,39.33 74.18,47.44 71.00,48.97
65.77,51.50 61.50,47.23 64.03,42.00
65.88,38.16 73.38,31.43 77.00,29.03
82.75,27.28 85.44,30.36 83.40,36.00 Z" />
</svg>
To convert it in a good Android xml, I think it should be modified like that ( it's only an example, just that you see I understood, I think)
Example of result possible:
Code:
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="23,996992dip" android:width="37,32864dip" android:autoMirrored="true" android:viewportWidth="24.0" android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@*common:color/theme_dark_side_green_color" android:pathData="M19.700001,20.000000l2.000000,0.000000l0.000000,2.000000l-2.000000,0.000000z" />
<path android:fillColor="@*common:color/theme_dark_side_green_color" android:pathData="M19.700001,10.000000l2.000000,0.000000l0.000000,8.100000l-2.000000,0.000000z" />
<path android:fillColor="@*common:color/theme_dark_side_QS_icon_color_disabled" android:pathData="M17.700001,8.000000l4.299999,0.000000 0.000000,-6.000000 -20.000000,20.000000 15.700001,0.000000z" />
</vector>
In this synthax, my only issue will be perhaps the size, on the files makes by Gimp, the size is in Inch, so I have to convert it too...
Like that:
For xxhdpi (what I mainly use in the theme):
1 inch = 96 pixel
1dp = 3 pixel
ldpi 48.00dp = 36.00px = 0.30in
mdpi 48.00dp = 48.00px = 0.30in
tvdpi 48.00dp = 63.90px = 0.30in
hdpi 48.00dp = 72.00px = 0.30in
xhdpi 48.00dp = 96.00px = 0.30in
xxhdpi 48.00dp = 144.00px= 0.30in
xxxhdpi 48.00dp = 192.00px= 0.30in
Can you confirm and make me a model of that?
Click to expand...
Click to collapse
actually it wont be 4 lines...its more complicated since one line with 1 semi-circle on top and 1 semi-circle on bottom of each "line"
although i cant make u the vector because my Windows7 HDD burnt :crying: i got no tools to do it for now.but i promise since new week,u will have it
EDIT:
about coordinates etc...i mention in first post that the coords of google's sketch and actual android pattern differs.
google's sketch app seems buggy
side said:
actually it wont be 4 lines...its more complicated since one line with 1 semi-circle on top and 1 semi-circle on bottom of each "line"
although i cant make u the vector because my Windows7 HDD burnt :crying: i got no tools to do it for now.but i promise since new week,u will have it
EDIT:
about coordinates etc...i mention in first post that the coords of google's sketch and actual android pattern differs.
google's sketch app seems buggy
Click to expand...
Click to collapse
OK
You cant put four "pathData"... weird, it ssemed to have seen it.
@side
Would you mean like this image below? For each part?
Sorry for the quality!
franzyroy said:
@side
Would you mean like this image below? For each part?
Sorry for the quality!
Click to expand...
Click to collapse
yes yes thats what i mean
Awesome guide @side very helpful for me, theme developers.
Thanks!
franzyroy said:
OK
You cant put four "pathData"... weird, it ssemed to have seen it.
Click to expand...
Click to collapse
yes you can...you use "Group" mention..check the guide.i use 2 Groups for 2 patterns

Can Tasker Turn on Screen Mirroring?

I have tried doing searches but it seems there is no way I have found yet to get Tasker to turn on Screen Mirroring. I found a app that provided a plug-in for ChromeCast but that did not seem to enable Screen Mirroring.
Anyone manage to get Tasker to toggle Screen Mirroring?
Thanks in advance.
AutoCast plugin (I'm assuming that's the one you're referring to) definitely lets you cast your screen. Check it again.
Yes, AutoCast was the one I tried. It did not seem to work. Perhaps I had it configured wrong? I will try it again.
Reading more, perhaps AutoInput is what I need. Researching further...
I use tasker to turn on screen mirroring (Samsung Smart View)
My car has a screenbeam mini2 dongle attached to my radio. When Tasker sees my BT attach, it turns on screen mirroing.
1. Install Tasker
2. Restore the attached backup, I first made an empty backup to have tasker create/write to the backup location, and then I overwrote it with the attached xml and restored it. Make a backup of what you have (if needed) and then restore this file so you can see how it is done. It needs 'Secure Settings' app (with root)
3. Install Secure Settings
4. You need SYSTEM+ enabled (to make it request root, add a empty file /system/bin/su if needed to have the app see root)
To have cast auto-retry, have only one device in your cast list. When it sees only one device, it auto-retries while the screen beam boots up.
See my demo here - https://youtu.be/hwzIRj7YI_o
Tasker backup contents;
<TaskerData sr="" dvi="1" tv="4.8u1m">
<Profile sr="prof2" ve="2">
<cdate>1456283182369</cdate>
<edate>1456284796400</edate>
<id>2</id>
<mid0>3</mid0>
<nme>Automirror</nme>
<State sr="con0" ve="2">
<code>3</code>
<Str sr="arg0" ve="3">AppRadio SPH-DA210</Str>
<Str sr="arg1" ve="3">90:03:B7:6C:38:2A</Str>
</State>
</Profile>
<Task sr="task3">
<cdate>1456283190251</cdate>
<edate>1456284679577</edate>
<id>3</id>
<nme>Cast</nme>
<Action sr="act0" ve="7">
<code>11820</code>
<Bundle sr="arg0">
<Vals sr="val">
<com.intangibleobject.securesettings.plugin.extra.BLURB>cast (Root)</com.intangibleobject.securesettings.plugin.extra.BLURB>
<com.intangibleobject.securesettings.plugin.extra.BLURB-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.BLURB-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT>false</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_OUTPUT-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST>false</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST>
<com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_DISPLAY_TOAST-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_NAME>cast</com.intangibleobject.securesettings.plugin.extra.CMD_NAME>
<com.intangibleobject.securesettings.plugin.extra.CMD_NAME-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_NAME-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS>false</com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS>
<com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_REPLACE_VARS-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN>am start -a com.sec.android.allshare.intent.action.CAST_START</com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN>
<com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.CMD_TO_RUN-type>
<com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT>true</com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT>
<com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.CMD_USES_ROOT-type>
<com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE>false</com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE>
<com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE-type>java.lang.Boolean</com.intangibleobject.securesettings.plugin.extra.KEEP_DEVICE_AWAKE-type>
<com.intangibleobject.securesettings.plugin.extra.SETTING>run_cmd</com.intangibleobject.securesettings.plugin.extra.SETTING>
<com.intangibleobject.securesettings.plugin.extra.SETTING-type>java.lang.String</com.intangibleobject.securesettings.plugin.extra.SETTING-type>
<com.twofortyfouram.locale.intent.extra.BLURB>cast (Root)</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.intangibleobject.securesettings.plugin</Str>
<Str sr="arg2" ve="3">Secure Settings</Str>
<Int sr="arg3" val="30"/>
</Action>
</Task>
</TaskerData>
Click to expand...
Click to collapse
Thank you for posting this. I tried it but Tasker provides an error when the above is restored. I put this through an XML checker and it shows errors. Seems to have some extra spaces embedded, which are easy to correct. But when I import, the is an ! next to the profile and task.
Is this have an extra space?
<com.twofortyfouram.locale.intent.extra.BLURB>ca st (Root)
EDIT - once I edit the above to "cast" within Tasker itself, this does work!
I know this is old but did you ever get a solution?
Yes, the post by Horem does work if you take care of the small edit I point out above. Works very well.
Thank you for your response but I was looking for a solution that uses chromecast screen mirroring function and not miracast. Doesn't the solution above use miracast?

Magisk Module HELP - Please

Hello guys im trying from long time to understand why Gcam no matter from the version the slow motion never worked on HTC 10 and i think is related to the media_profiles.xml because we miss some important lines in order the Slow Motion to work properly.
Anyway sometimes when the things go wrong and edit manually the Media xml file i can recive a nasty bootlopp and in order to not repeat the same all the times
can anyone who is familiar with Magisc create a simple module?! for test purpose.
This lines to be added to the Media_profiles.xml
No mater from the Buld you know that the Gcam always crash and force close when you switch to Slow Motion
But only with this MOD magisk module
https://forum.xda-developers.com/apps/magisk/module-gcam-patch-t3677993
In every build ive try i was able to switch to Slow Mo without a crash also im able to press the button of recorder and i saw the sign 120 FPS under slow motion the problem is that for now the VIEWER freeze and im not able to record a video.
But this module only add some lines in the media_presets xml so thats why i think we are close and im sure is something related just for the xml file something in our HTC 10 is different in that media profiles xml and we need to find out what exactly!
I think the GCAM cant read the seeting correctly from the XML if they are not corectly set or writen.
for example in my Media profiles by default the SLOW MOTION is missing but this dont preven the Stock HTC CAM to record slow mo maybe we have to add this in order if we want to make GCAM to work as well
If you wish chek your media_profiles.xml do u have something similar i think this is the correct lines that we are missing and have to add this line but because im tired of bootlops if im wrong everytime im looking for methood how to use it like a MODULE and in case something went wrong to be able to revert back to stock.
In the magisk module above some of the lines are incorrect and maybe thats why the view freeze
and think this are the correct we all have to add.
<!-- CAMCORDER_QUALITY_HIGH_SPEED_HIGH/720P : [email protected]; 27.0 Mbps -->
<EncoderProfile quality="highspeedhigh" fileFormat="mp4" duration="30">
<Video codec="h264"
bitRate="27000000"
width="1280"
height="720"
frameRate="120" />
<!-- audio setting is ignored -->
<Audio codec="aac"
bitRate="96000"
sampleRate="48000"
channels="2" />
</EncoderProfile>
<EncoderProfile quality="highspeed720p" fileFormat="mp4" duration="30">
<Video codec="h264"
bitRate="27000000"
width="1280"
height="720"
frameRate="120" />
<!-- audio setting is ignored -->
<Audio codec="aac"
bitRate="96000"
sampleRate="48000"
channels="2" />
</EncoderProfile>
<!-- CAMCORDER_QUALITY_HIGH_SPEED_HIGH/1080P : [email protected]; 34.0 Mbps -->
<EncoderProfile quality="highspeed1080p" fileFormat="mp4" duration="30">
<Video codec="h264"
bitRate="34000000"
width="1920"
height="1080"
frameRate="60" />
<!-- audio setting is ignored -->
<Audio codec="aac"
bitRate="96000"
sampleRate="48000"
channels="2" />
</EncoderProfile>
I think this is the missing part for the Slow Motion to work properly on HTC 10 and few other devices as well, because we by default don`t have that config in our media profiles.
Will be very thankfull.
Thanks
Hi
I have a xiaomi mi a1 and have the same problem. Even with the module you refered slow motion crashes gcam.
I've tried one other module here https://forum.xda-developers.com/apps/magisk/module-hevc-60fps-slomo-gcam-op3t-5-t3666287 and I can film at 120frames but it's laggy (filming and playing). I think it's because it is specific for those models.
I also would like to try a module that only adds the necessary lines to media_profiles.xml, but I don't know how to do it.
Did you try to talk with the gcam module creator to see if he can try to do one like you describe?
regards

Question Is there a way to make the rear display always on?

Is there a way to make the rear display always on? Currently its 30s max... I think xiaomi should allow us to set it to always. Its amoled afterall, the screen is amoled, and small.. So it wont tax the battery much i suppose?
Dekdek1 said:
Is there a way to make the rear display always on? Currently its 30s max... I think xiaomi should allow us to set it to always. Its amoled afterall, the screen is amoled, and small.. So it wont tax the battery much i suppose?
Click to expand...
Click to collapse
Haven't seen one yet, the back screen functionality is probably the biggest disappointment of this phone
The most useful feature of it is probably too prevent the phone wobbling if you use it on a table
Hopefully they will add functionality via software but after 6 weeks I'm starting to have my doubts and I'm on the latest EU weekly rom
By the way, not sure if its 100% accurate info but it seems we will have rear display working as a viewfinder for videos aswell soon.
Thx all for the input
use: setedit to edit the time of the rear screen from 3000 (30s) to what number you want. i use 3000000 so it kind like AOD
Barcovn said:
use: setedit to edit the time of the rear screen from 3000 (30s) to what number you want. i use 3000000 so it kind like AOD
Click to expand...
Click to collapse
# System Table
# "subscreen_display_time"
After reboot it is set to MIUI default value
katerpanne said:
# System Table
# "subscreen_display_time"
After reboot it is set to MIUI default value
Click to expand...
Click to collapse
Which miui Version are you using?
Cant find the specific entry.
Barcovn said:
use: setedit to edit the time of the rear screen from 3000 (30s) to what number you want. i use 3000000 so it kind like AOD
Click to expand...
Click to collapse
Do you need to root it for it?
doribak said:
Do you need to root it for it?
Click to expand...
Click to collapse
i done it today no root needed, but you have to type specifited command in ADB
lortwarCECH said:
i done it today no root needed, but you have to type specifited command in ADB
Click to expand...
Click to collapse
Any chance for a quick guide?
doribak said:
Any chance for a quick guide?
Click to expand...
Click to collapse
How to install ADB on Windows, macOS, and Linux
If you're on Windows, Linux or macOS, you can follow these step by step instructions to install ADB on your desktop or laptop PC.
www.xda-developers.com
When you have already instaled ADB, type this in command line: "ADB shell" and then:
"pm grant by4a.setedit22 android.permission.WRITE_SECURE_SETTINGS"
Barcovn said:
use: setedit to edit the time of the rear screen from 3000 (30s) to what number you want. i use 3000000 so it kind like AOD
Click to expand...
Click to collapse
Brooo !! Thank you !!!
Make a separate thread for others.
lortwarCECH said:
How to install ADB on Windows, macOS, and Linux
If you're on Windows, Linux or macOS, you can follow these step by step instructions to install ADB on your desktop or laptop PC.
www.xda-developers.com
When you have already instaled ADB, type this in command line: "ADB shell" and then:
"pm grant by4a.setedit22 android.permission.WRITE_SECURE_SETTINGS"
Click to expand...
Click to collapse
After that it should stay as longer as we input the time? Even after reboot
avetny said:
After that it should stay as longer as we input the time? Even after reboot
Click to expand...
Click to collapse
it is working even after reboot
lortwarCECH said:
it is working even after reboot
Click to expand...
Click to collapse
Thx for this, now I can create a Tasker profil to turn on/off rear display
And in some months people will complain about screen burn in. Haha joking, but interesting if that happens.
For those looking for more rear screen function, just seen this on telegram
Xiaomi will be add some more exciting features at Mi 11 Ultra second display. As of now these are in testing.
- Video Recording
- Vlog Video
- Slow Motion
- Timed Continues Shooting
- Time lapse Photos
- Portrait Blur
- Night Scenes
Join @TecnoStreet
Dekdek1 said:
Is there a way to make the rear display always on? Currently its 30s max... I think xiaomi should allow us to set it to always. Its amoled afterall, the screen is amoled, and small.. So it wont tax the battery much i suppose?
Click to expand...
Click to collapse
You can use the tool "setedit" from playstore
# System Table
# "subscreen_display_time"
Put in a very high numer
chrissss91 said:
Thx for this, now I can create a Tasker profil to turn on/off rear display
Click to expand...
Click to collapse
Can u please show how to make task for rear display with display on/off profile.... As I can't find the the task which activate the rear display...
abhati17 said:
Can u please show how to make task for rear display with display on/off profile.... As I can't find the the task which activate the rear display...
Click to expand...
Click to collapse
Hello,
Here are my 2 'test' tasks :
Enable subscreen :
Code:
<TaskerData sr="" dvi="1" tv="5.12.22">
<Task sr="task113">
<cdate>1621772438105</cdate>
<edate>1627111965882</edate>
<id>113</id>
<nme>Test subscreen On</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>123</code>
<label>Enable subscreen</label>
<Str sr="arg0" ve="3">settings put system subscreen_gesture_wakeup 1
settings put system subscreen_switch 1
settings put system subscreen_switch_show_notification_content 1</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
</Task>
</TaskerData>
Disable subscreen :
Code:
<TaskerData sr="" dvi="1" tv="5.12.22">
<Task sr="task101">
<cdate>1621772438105</cdate>
<edate>1627111982325</edate>
<id>101</id>
<nme>Test subscreen Off</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>123</code>
<label>Disable Subscreen</label>
<Str sr="arg0" ve="3">settings put system subscreen_gesture_wakeup 0
settings put system subscreen_switch 0
settings put system subscreen_switch_show_notification_content 0</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
</Task>
</TaskerData>
You can also modify display time, just add this line with other commands :
settings put system subscreen_display_time 300000

Categories

Resources