====== About the script ====== * Purpose : This script is a multifunctional tool to do or show a lot of stuff * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Link : https://plus.google.com/115366157037831519359/posts/fQwfu5AUj5m * Download available! (Check repository) ====== How to use the script ====== * see App ====== Current functionality ====== * Show Event related parameters * Show Container related parameters * Show Item related parameters * Show Icons and images for an item * Attach/Detach all Items * Resize all detached items * Delete all Items * Move (a) specific page(s) to another position. This can be used to change the home page by selecting all items * Export Scripts * Import Script * Autoformat Script * Search in Scripts * Reset Tags * Reset Tool © by trianguloY * save all Layout changes * Reset the recent apps list //please report all bugs in the g+ community// //Created by Lukas Morawietz in collaboration with TrianguloY //import java classes LL.bindClass("android.app.AlertDialog"); LL.bindClass("android.app.ProgressDialog"); LL.bindClass("android.content.DialogInterface"); LL.bindClass("android.os.Environment"); LL.bindClass("android.R"); LL.bindClass("android.widget.ExpandableListView"); LL.bindClass("android.widget.ImageView"); LL.bindClass("android.widget.LinearLayout"); LL.bindClass("android.widget.ListView"); LL.bindClass("android.widget.NumberPicker"); LL.bindClass("android.widget.SimpleAdapter"); LL.bindClass("android.widget.SimpleExpandableListAdapter"); LL.bindClass("android.widget.ScrollView"); LL.bindClass("android.widget.TextView"); LL.bindClass("java.io.File"); LL.bindClass("java.io.BufferedReader"); LL.bindClass("java.io.FileReader"); LL.bindClass("java.io.FileWriter"); LL.bindClass("java.util.HashMap"); LL.bindClass("java.util.ArrayList"); var hasItem=(LL.getEvent().getItem()!=null); //define Strings to display var title="What do you want to do?"; var items=[] var info=["Information",[]]; info[1].push("Event"); info[1].push("Container") if(hasItem){ info[1].push("Item"); info[1].push("Intent"); info[1].push("Icon"); } var itemUtils=["Item Utilities",[]]; itemUtils[1].push("Attach/Detach all Items"); itemUtils[1].push("Resize all detached Items"); itemUtils[1].push("Delete all Items"); itemUtils[1].push("Move Pages"); var scriptUtils=["Script Tools",[]]; scriptUtils[1].push("Export Scripts (Backup)"); scriptUtils[1].push("Import Script"); scriptUtils[1].push("Autoformat Scripts"); scriptUtils[1].push("Search in Scripts"); var other = ["Other",[]]; other[1].push("Reset Tag"); other[1].push("Reset Tool"); other[1].push("Save changes"); other[1].push("Delete recent app history"); items.push(info); items.push(itemUtils); items.push(scriptUtils); items.push(other); //normal run if(typeof resultCode==='undefined') expandableList(items,mainOnClick,title); //user has selected a file to import else import_handleInput(); //handle user selection function mainOnClick(groupPosition,childPosition){ switch(groupPosition){ case 0://Information switch(childPosition){ case 0://Event related eventData(); break; case 1://container related containerData() break; case 2://item related itemData(); break; case 3://intent intentData(); break; case 4://icon iconData(); break; } break; case 1://item utilities switch(childPosition){ case 0://Attach/Detach all items attachDetachAll(); break; case 1://resize detached items resizeAllDetached(); break; case 2://delete items deleteAll(); break; case 3://move pages movePages(); break; } break; case 2://Script Tools switch(childPosition){ case 0://export exportScripts(); break; case 1://import import_askForInput(); break; case 2://autoformat autoFormat(); break; case 3://serach in scripts searchScripts(); break; } break; case 3://other switch(childPosition){ case 0://reset Tag resetTags(); break; case 1://reset tool by trianguloY, ask him how it works :D resetTool(); break; case 2: saveLayout(); break; case 3: resetRecents(); break; } break; } } function eventData(){ var e=LL.getEvent(); try{ //test if event contains touch data e.getTouchScreenX(); var ok=true; } catch(Exception){ var ok=false; } text("Source: "+e.getSource()+"\nDate: "+e.getDate()+"\nContainer: "+e.getContainer()+"\nItem: "+e.getItem()+(ok?("\nTouch: "+e.getTouchX()+","+e.getTouchY()+"\nTouch (Screen): "+e.getTouchScreenX()+","+e.getTouchScreenY()):""),"Event Information"); } function containerData(){ var c=LL.getEvent().getContainer(); var t=c.getType();//Differentiate between Desktop and other containers //read Tags from launcher file var s=read(LL.getContext().getFilesDir().getPath()+"/pages/"+c.getId()+"/conf"); var data=JSON.parse(s); var tags="Default: "+c.getTag(); for(property in data.tags) tags+="\n"+property+": "+data.tags[property]; text("Type: "+t+"\nName/Label: "+(t=="Desktop"?c.getName():c.getOpener().getLabel())+"\nID: "+c.getId()+"\nSize: "+c.getWidth()+","+c.getHeight()+"\nBoundingbox: "+c.getBoundingBox()+"\nCell Size: "+c.getCellWidth()+","+c.getCellHeight()+"\nCurrent Position: "+c.getPositionX()+","+c.getPositionY()+"\nCurrent Scale: "+c.getPositionScale()+"\nTags: "+tags+"\nItems: "+c.getItems(),"Container Information"); } function itemData(){ var i=LL.getEvent().getItem();if(i==null)//check if event contains item text("no item found","Error 5"); //read tags from launcher file var s=read(LL.getContext().getFilesDir().getPath()+"/pages/"+LL.getEvent().getContainer().getId()+"/items"); var all=JSON.parse(s).i; var x; var item; for(x=0;x0){ //at least one image found var scroll=new ScrollView(LL.getContext()); scroll.addView(root); customDialog(scroll,"Icon"); } else Android.makeNewToast("No Image Data available",true).show(); //no image found } function attachDetachAll(){ var items=LL.getEvent().getContainer().getItems(); var attachDetach = function(toGrid){ for(x=0;x