Posted by: CK Portable | on March 19, 2015
Items… menu has a compact and sort az/za, can these be called by script?
Posted in Lightning Launcher Users: Discussion / Ask here | 4 Comments » Tags: CK Portable
Yes. Its not as easy as one might think though.
//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);
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.
To run a script when a folder opens use resume event.
I haven’t found a way to detect content change…
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Yes. Its not as easy as one might think though.
//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);
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.
To run a script when a folder opens use resume event.
I haven’t found a way to detect content change…