Items… menu has a compact and sort az/za, can these be called by script?

Items… menu has a compact and sort az/za, can these be called by script?

4 Commentsto Items… menu has a compact and sort az/za, can these be called by script?

  1. Yes. Its not as easy as one might think though.

  2. //config

    var trace=[“Items”,”Sort z-a”];

    //endconfig

    LL.bindClass(“android.R”);

    LL.bindClass(“java.util.ArrayList”);

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

    var p=0;

    var menuRoot=LL.getContext().getWindow().getDecorView().findViewById(R.id.content).getChildAt(0).getChildAt(2).getChildAt(2);

    var menu = menuRoot.getChildAt(0);

    var obs=menuRoot.getViewTreeObserver();

    var l=new ViewTreeObserver.OnGlobalLayoutListener(){

    onGlobalLayout:function()

    {

    var list=new ArrayList();

    menu.findViewsWithText(list,trace[p],1);

    if(list.size()>0){

    list.get(0).callOnClick();

    p++;

    if(p>=trace.length)obs.removeOnGlobalLayoutListener(l);

    }

    return true;

    }

    };

    obs.addOnGlobalLayoutListener(l);

    LL.runAction(7);

  3. CK Portable says:

    I’d like this to run on a folder when the folder is opened, or when content changed.

    To make it optional per folder, an invisible item could be looked for.

    The custom view has start script but not triggered when folder opened, ofc, also not invis, can only be made transparent. 

    Many ifs.

  4. To run a script when a folder opens use resume event.

    I haven’t found a way to detect content change…

Leave a Reply

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