User Tools

Site Tools


script_appdrawer_toggle_visibility

====== About the script ====== * Purpose : This script will toggle the Visibility of all shortcuts in the App Drawer. So on first run you only see the hidden Shortcuts, on the second run you have all your visible shortcuts back * Author : F43nd1r * Current Version : 1.1 * Link : https://plus.google.com/115366157037831519359/posts/YubDRu2LRLj ====== Changelog ====== * Version 1.0 (14/9/2014): initial release in wiki * Version 1.1 (16/9/2014): use of JSON to reduce and simplify code, probably reduces Runtime ====== How to use the script ====== * Run from anywhere ====== Issues and Hints ====== * The launcher gets restarted in the process //please report all bugs in the g+ community!// ====== Script ====== <sxh javascript;>//import java classes LL.bindClass("java.io.FileReader"); LL.bindClass("java.io.BufferedReader"); LL.bindClass("java.io.FileWriter"); LL.bindClass("java.io.File"); LL.bindClass("java.lang.System"); //check the app drawer var containers=["99"]; for(var y=0;y<containers.length;y++) { //search for folders in the current container and add them to the queue var items=LL.getContainerById(containers[y]).getItems(); for(var x=0;x<items.length;x++) { var i=items.getAt(x); if(i.getType()=="Folder")containers.push(i.getContainer().getId()); } //create the needed structure var file=new File("data/data/net.pierrox.lightning_launcher_extreme/files/pages/"+containers[y]+"/items");//this file contains item properties var r=new BufferedReader(new FileReader(file)); var s=""; //read the file var l=r.readLine(); while(l!=null) { s+=l; l=r.readLine(); } //toggle hidden for all shortcuts var data=JSON.parse(s); for(var a=0;a<data.i.length;a++) { if(data.i[a].a=="SHORTCUT") { data.i[a].g=!data.i[a].g; } } //write the changed stuff back to the file var w=new FileWriter(file); w.write(JSON.stringify(data)); w.flush(); w.close(); } //restart the launcher System.runFinalization(); System.exit(0); </sxh>

script_appdrawer_toggle_visibility.txt · Last modified: 2016/06/28 12:23 by f43nd1r