Something I think would be useful – built-in panel item with recently launched, most launched or recently updated…
Something I think would be useful – built-in panel item with recently launched, most launched or recently updated apps.
]]>
« hi, newbie to Lightning here. (Previous Post)
(Next Post) Can anyone tell me how to use the textual page indicator if I long press the setting it says not found. »
< ![CDATA[
There is a script from TrianguloY for the most launched. Try it
]]>
< ![CDATA[
Abdullah Alahdal thank you!
]]>
< ![CDATA[
Abdullah Alahdal But it works in drawer only, doesn’t it?
]]>
< ![CDATA[
I have it in my home screen. There was a post where TrianguloY had guided me to achieve moving the panel.
]]>
< ![CDATA[
And in fact I modified it myself, but never published it I think.
Here you have, just change the id at the beginning of the script
]]>
< ![CDATA[
//start config
var increase = 1.2
var decrease = 0.99;
var name=”most used”;
var tag=”most used”;
var id=99;//id of the container where the panel will be placed
//end config
var event=LL.getEvent();
var item=event.getItem();
var source=event.getSource();
var scriptid=LL.getCurrentScript().getId();
var drawer=LL.getContainerById(99);
var panel=LL.getContainerById(id).getItemByName(name);
if(source==”MENU_APP” || panel==null || item==null){
var noexist= (panel==null);
if(!confirm(“This will set all the tap action of all the containers from the app drawer to run this script.” + ( noexist?” And will add a ‘most used apps’ panel at the top.”:””) + “\n Do you want to continue?”)){
if(confirm(“Do you want instead to uninstall the script?”)){
uninstall();
}
return;
}
install();
return;
}
panel=panel.getContainer();
if(source==”I_CLICK”){
if(item.getType()==”Folder”)tappedFolder(item);
if(item.getType()==”Shortcut”)tappedItem(item);
return;
}
if(source==”MENU_ITEM” && item.getParent()==panel){
deleteItem(item);
return;
}
//else
Android.makeNewToast(“Run the script from the menu app”, true).show();
function install(){
if(noexist){
panel=LL.getContainerById(id).addPanel(0,0,drawer.getWidth(),1);
LL.save();
panel.setName(name);
panel.getContainer().getProperties().edit().setInteger(“gridPRowNum”,1).commit();
prepareContainer(panel.getContainer(),true);
}
//LL.save();
prepareContainer(drawer,true);
}
function uninstall(noexist){
if(!noexist)LL.getContainerById(id).removeItem(panel);
LL.save();
prepareContainer(drawer,false);
}
function prepareContainer(cont,install){
var handler= install? EventHandler.RUN_SCRIPT : EventHandler.UNSET;
var items=cont.getItems();
for(var t=0;t
var item=items.getAt(t);
if(item.getType()==”Folder” || item.getType()==”Panel”)prepareContainer(item.getContainer(),install);
}
cont.setTag(tag, install? 1 : null);
cont.getProperties().edit().setEventHandler(“i.tap”,handler,scriptid).commit();
}
function tappedItem(tapped){
var component=tapped.getIntent().toURI();
var items=panel.getItems();
var list=[];
var exists=false;
for(var t=0;t
var item=items.getAt(t);
list[t]=item;
if(component==item.getIntent().toURI()){
item.setTag(tag, Math.min(item.getTag(tag)*increase,2) );
exists=true;
}else{
item.setTag(tag, Math.max(item.getTag(tag)*decrease,0.5) );
}
//item.setLabel(item.getTag(tag));
}//end for
if(!exists){
var added=panel.addShortcut(tapped.getLabel(),tapped.getIntent(),0,0);
added.setTag(tag,1);
added.setDefaultIcon(tapped.getDefaultIcon());
list.push(added);
}
update(list);
tapped.launch()
}
function update(list){
if(list==null){
var items=panel.getItems();
list=[];
for(var t=0;t
}
list.sort(function(a,b){return b.getTag(tag)-a.getTag(tag);});
for(var t=0;t
list[t].setCell(t,0,t+1,1,true);
}//end for
}//end function
function tappedFolder(folder){
if(folder.getContainer().getTag(tag)==null) prepareContainer(folder.getContainer(),true);
folder.launch();
}
function deleteItem(item){
if(confirm(“Do you want to delete this item?”))panel.removeItem(item);
update();
}
]]>