Hi guys
Hi guys,
There is a way to set styles to containers (through scripting obviously)?
]]>« what is the image pool size ? is it a cache for icons ? thanx ^^ (Previous Post)
(Next Post) Can I discuss “Lightning Locker Plugin” here? »
< ![CDATA[
Does anyone have any ideas?
Please, i need an answer as soon as possible.
]]>
< ![CDATA[
It is the same as editing items properties (container.getProperties().edit().something().commit() )
http://www.pierrox.net/android/applications/lightning_launcher/script/reference/net/pierrox/lightning_launcher/script/api/PropertySet.html
]]>
< ![CDATA[
TrianguloY It was not what I meant xD
For “style” i mean the entire configuration of the container (Panel Settings –> Load a style).
Sincerely, I was so bored that I started to find a solution by myself…
I noticed that the styles files are nothing more than a config file, and when a style is loaded LL take the content of that file and put it in the conf file of the container folder.
So what i have to do is to read the content of the file “LL.getContext().getFilesDir()+”/themes/styleName” and write it in “LL.getContext().getFilesDir()+”/pages/”+container.id+”/conf”.
Am I right?
]]>
< ![CDATA[
That sounds as a tricky hack…I don’t know. Test it and tell us! (Remember to make a backup!!!)
]]>
< ![CDATA[
God yes! It works perfectly and I succeeded on the first try!!
Instead of read and write the content of each file I preferred to replace them with a copy of the source file.
Just another problem is left:
after the files have been replaced is necessary to restart LL to see the changes.
So, how can I update the container without restart?
]]>
< ![CDATA[
No idea.
I’ll call Lukas Morawietz, not only because he can provide an answer but also because I think he will like this ‘hack’
]]>
< ![CDATA[
You can’t reload files without restarting lightning. There is no hook for that. You can restart by script with http://www.pierrox.net/android/applications/lightning_launcher/script/reference/net/pierrox/lightning_launcher/script/api/EventHandler.html#RESTART
]]>
< ![CDATA[
Lukas Morawietz if it were so, then the property will not be updated in real time ever.
There must to be a way.
Maybe the properties are temporarily saved in memory?
]]>
< ![CDATA[
Simone Boccuzzi
of course they are. Working directly on files would be way too inefficient.
]]>
< ![CDATA[
Lukas Morawietz so what i could do to apply the entire style in real time?
]]>
< ![CDATA[
Simone Boccuzzi
parse the file and set the properties via the PropertyEditor
]]>
< ![CDATA[
Loooool, it’s right xD
How could I do it exactly?
]]>
< ![CDATA[
var d = JSON.parse(string-from-file);
if(d.bgColor != null) //set background color
etc. etc. etc.
]]>
< ![CDATA[
ooook it works! But now another problem arises D:
My style includes Normal Selected and Focused background Imgs.
I can get their Bitmaps in this way:
var imgNormal= new File(LL.getContext().getFilesDir()+”/themes/”+styleName+”n”).getBitmap;
ecc…
But where can I apply them?
EDIT: Please, don’t tell me I have to manually apply them to all the items D:
]]>
< ![CDATA[
It should work applying the item property (“i.something”) to the container properties
]]>