Thanks to Bruno-Isa LAMOUR-ARNOULD who reported and Pierre Hébert who showed the right direction.
Thanks to Bruno-Isa LAMOUR-ARNOULD who reported and Pierre Hébert who showed the right direction.
Here is a bug fix for the menu change script:
Names with dots now have to be put there without dots.
]]>« When setting a script on a gesture (Previous Post)
(Next Post) Hi! I think I found a bug, or something similar. »
< ![CDATA[
//config
var color=0xFF707070;
var selectionColor=0xFF202020;
var hide=[“Items”];
//endconfig
LL.bindClass(“android.R”);
LL.bindClass(“android.view.ViewGroup”);
LL.bindClass(“android.graphics.PorterDuff”);
LL.bindClass(“android.view.ViewTreeObserver”);
LL.bindClass(“android.graphics.drawable.ColorDrawable”);
LL.bindClass(“android.graphics.drawable.StateListDrawable”);
LL.bindClass(“android.util.StateSet”);
var menuRoot=LL.getContext().getWindow().getDecorView().findViewById(R.id.content).getChildAt(0).getChildAt(2).getChildAt(2);
var menu = menuRoot.getChildAt(0);
var triangleDown = menuRoot.getChildAt(1);
var triangleUp = menuRoot.getChildAt(2);
menu.setBackgroundColor(0xFF707070);
var tDown=LL.createImage(40,20);
var c=tDown.draw();
var path=new Path();
path.moveTo(0,0);
path.lineTo(20,20);
path.lineTo(40,0);
path.lineTo(0,0);
path.close();
var paint = new Paint();
paint.setColor(color); paint.setStyle(Paint.Style.FILL_AND_STROKE);
paint.setAntiAlias(true);
c.drawPath(path,paint);
triangleDown.setImageBitmap(tDown.getBitmap());
var tUp=LL.createImage(40,20);
var c=tUp.draw();
var path=new Path();
path.moveTo(0,20);
path.lineTo(20,0);
path.lineTo(40,20);
path.lineTo(0,20);
path.close();
c.drawPath(path,paint);
triangleUp.setImageBitmap(tUp.getBitmap());
var obs=menuRoot.getViewTreeObserver();
obs.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
onGlobalLayout:function()
{
var list=menu.getChildAt(0);
for(var i=0;i
var item=list.getChildAt(i);
if(hide.indexOf(item.getText().replace(“…”,””).replace(“…”,””))!=-1){
list.removeView(item);
continue;
}
var drawable= new StateListDrawable();
drawable.addState([R.attr.state_pressed],new ColorDrawable(selectionColor)); drawable.addState(StateSet.WILD_CARD,new ColorDrawable(0x00000000));
item.setBackground(drawable);
}
return true;
}
});
]]>
< ![CDATA[
… must be used
]]>
< ![CDATA[
No, in this version neither … nor … should be used. This is easier for all.
]]>
< ![CDATA[
Lukas Morawietz yes really good
]]>
< ![CDATA[
Lukas Morawietz noticed as you said that the menu is rebuilt very often
How can I be sure it will be rebuilt by the script ? May I have to use Reload event ?
For now I’m running the script from Lightning menu
]]>
< ![CDATA[
Try the load event of your desktop. If that does not work, use the resume event. The script registers a listener which is called very often (exactly every time something changes in the layout).
So the script makes itself running more often than needed ;).
Actually I’m thinking of ways how to determine if the script has to be run, so it is run less. For example if the menu gets closed its run also, which is unnessesary.
]]>
< ![CDATA[
Lukas Morawietz I can’t add a script to any gesture. Lightning launcher stopping after chosing the script
]]>
< ![CDATA[
Bruno-Isa LAMOUR-ARNOULD any script or this script in particular?
]]>
< ![CDATA[
Lukas Morawietz any
]]>
< ![CDATA[
Lukas Morawietz hi Lukas. Could you help me : I want to change the color of the items in order to fit my background
And font if possible TrianguloY
]]>
< ![CDATA[
So i just installed this script and it gave me this error: At line 44: TypeError: cannot find function setlmageBitmap in object android.widget.Button{ app:id/gb_vm}
Can you fix this?
]]>
< ![CDATA[
Colin de Roos
It seems like this script doesn’t work with the newer Lightning Version (it was developed for a menu without th etop three buttons). I’ll see what I can do.
]]>
< ![CDATA[
Pierre Hébert in order to reduce the unreliability of this script, could you tell me some resource identifier names for the menu?
]]>