Script: enhance lightning menu

Script: enhance lightning menu

This is an example script how to modify the lightning menu background. Scripters – feel free to modify to create even more beautiful menus.

Pierre Hébert​ I feel a bit sorry to hack your app – with your app 😄

This script needs to be run at least every time the launcher gets restarted.

]]>

17 Commentsto Script: enhance lightning menu

  1. Anonymous says:

    < ![CDATA[

    LL.bindClass(“android.R”);


    LL.bindClass(“android.view.ViewGroup”);


    LL.bindClass(“android.graphics.PorterDuff”);




    var color= 0xFF707070;




    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(20,20);


    var c=tDown.draw();


    var path=new Path();


    path.moveTo(0,0);


    path.lineTo(10,20);


    path.lineTo(20,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(20,20);


    var c=tUp.draw();


    var path=new Path();


    path.moveTo(0,20);


    path.lineTo(10,0);


    path.lineTo(20,20);


    path.lineTo(0,20);


    path.close();


    c.drawPath(path,paint);



    triangleUp.setImageBitmap(tUp.getBitmap());

    ]]>

  2. Anonymous says:

    < ![CDATA[

    That’s…exactly what I wanted!!! Retrieve the views!



    +9999999



    How do you discovered you need to ‘go down three childs’ to access that menu? Do you know a way to search the tree and * cough * get the views of an item * cough * ? 😛



    Just awesome. I’ll use it too much.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Is there a way to hide some elements in the menu ?

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Bruno-Isa LAMOUR-ARNOULD probably yes, but I haven’t figured out how without crashing the launcher.

    ]]>

  5. Anonymous says:

    < ![CDATA[

    TrianguloY not that easy to read, I copied that from stackoverflow and changed syntax to javascript…



    function printViewHierarchy(vg,prefix) {


    for (var i = 0; i < vg.getChildCount(); i++)


    {


    var v = vg.getChildAt(i);


    var desc = prefix + ” | ” + “[” + i + “/” + (vg.getChildCount()-1) + “] “+ v.getClass().getSimpleName() + ” ” + v.getId();


    LL.writeToLogFile(desc+”\n\n”,true);


    if (v instanceof ViewGroup) {


    printViewHierarchy(v, desc);


    }


    }


    }

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Child path to item views are sth like 0,1,0,0



    The easiest way to find a specific item is to try the child path out and set the background of the view to a color so you can see where a view is located. As long as all gets the background you need to go deeper.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Bruno-Isa LAMOUR-ARNOULD it seems like the menu items get regenerated every time the menu gets opened, so I don’t know how to add or remove elements.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Nice, it had to be done 🙂



    Although this is no more than a kludge, I like it because this is really funny.


    If you need more insight on the internal structure, don’t hesitate to ask 😉

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Pierre Hébert in fact you could help me by telling me the ids of your views (of course only the ones which have an ID)

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Just making an assumption.. This means we could potentially modify any item or menu within lightning right?

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Theoretically, yes. However there are always limitations. For example changing the LL menu items is not possible, because the list gets regenerated each time the menu opens.

    ]]>

  12. Anonymous says:

    < ![CDATA[

    very very good job!



    maybe Pierre Hébert can this script add directly to LL as function in settings 😉

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Danbar Danbar Pierre can do things a lot easier, and probably won’t use such a way. He can just create a hook in his code to a setting…

    ]]>

  14. Anonymous says:

    < ![CDATA[

    In past, i write about this option in Feature Suggestion. (in to do list is this suggestion).



    plus will be good enable set different corners by nine path, etc.

    ]]>

  15. Anonymous says:

    < ![CDATA[

    Lukas Morawietz  bug in this script… try please add new panel or new folder 😉

    ]]>

  16. Anonymous says:

    < ![CDATA[

    Danbar Danbar works for me.

    ]]>

  17. Anonymous says:

    < ![CDATA[

    Lukas Morawietz this is not really easy to share ids because these numerical values may change from one build to another. At the source level you manipulate constants that are translated into integer identifiers at build time. Changing one id somewhere may shift the array in the final build.


    Maybe something that could “help” you is to have a look at the xml layout files (you need to extract the apk and decompile the app (not just unzip), but that shouldn’t be too much a problem, right 😉 ). From there you will find the view hierarchy, with the actual id values. There is the particular case of the bubble menu and desktops where views are dynamically added, but this are the only exceptions (I can think of yet)



    Edit: fixed an important lapsus, “run time” -> “build time”

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *