now browsing by category

 

If anyone else wants a script to automatically import modified .js files elsewhere on your device into the script…

If anyone else wants a script to automatically import modified .js files elsewhere on your device into the script editor, here is one:

var scriptFolder = “/storage/emulated/0/LightningLauncher/script”;

LL.bindClass(“java.lang.StringBuilder”)

LL.bindClass(“java.io.FileReader”)

LL.bindClass(“java.io.BufferedReader”)

LL.bindClass(“java.io.File”)

LL.bindClass(“java.text.SimpleDateFormat”)

scriptNames = []

folder = new File(scriptFolder)

files = folder.listFiles()

for(i=0;i

name = files[i].getName()

length = name.length

if(name.substring(length-3,length)==”.js”){

scriptNames[scriptNames.length] = name

}

}

for(i=0;i

var script=LL.getScriptByName(scriptNames[i].substring(0,scriptNames[i].length-3));

file = new File(scriptFolder,scriptNames[i])

lmdate = file.lastModified()

tagdate = script.getTag(“lmdate”)

if(lmdate>tagdate||typeof tagdate == “undefined”){

text = new StringBuilder();

try {

br = new BufferedReader(new FileReader(file));

var line

while ((line = br.readLine()) != null) {

text.append(line);

text.append(‘\n’);

}

br.close();

script.setText(text);

date = new Date()

script.setTag(“lmdate”,date.getTime())

}

catch (err) {

throw(err)

}

}

}

http://java.io
]]>

Hi, does somebody know a good code editor that works wel with the “edit” button in the script editor menu?

Hi, does somebody know a good code editor that works wel with the “edit” button in the script editor menu? The default script editor is OK, but there are way better alternatives.

]]>

Anyone can explain why ItemClick event does not work with GridView in AlertDialog?

Anyone can explain why ItemClick event does not work with GridView in AlertDialog? It should, googled, all samples are like this. In pure Java, though… Dialog shows properly, can click, but no event is fired.

var llCtx=LL.getContext();

var adapter=new ArrayAdapter(llCtx, R.layout.simple_list_item_1, items);

var gridView=new GridView(llCtx);

gridView.setAdapter(adapter);

gridView.setNumColumns(4);

gridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){

onClick:function(parent,v,position,id)

{

Android.makeNewToast(id+”/”+position,true).show();

}

});

var builder=new AlertDialog.Builder(llCtx);

builder.setView(gridView);

builder.setTitle(title);

builder.show();

]]>

I’m having trouble copying a file inside a script.

I’m having trouble copying a file inside a script. I’m deleting the current LL desktop wallpaper, and then trying to copy a new one in there for a wallpaper changer. I have Java code to copy the file, but I’m having trouble with the javascript translation. Perhaps there’s an easy way to copy files inside LL scripts?

]]>

What is the best way to change the properties of multiple items via script at once?

What is the best way to change the properties of multiple items via script at once? A “for” loop could do it but is there a simpler way?

Can we set items to the same name and use getItemByName?

]]>

Promissed to share my webView/webApp script.

Promissed to share my webView/webApp script.

Please read first lines of the script and view the moviie for instructions.

]]>

for everyone who is, like me looking for some great reference to javascript.

for everyone who is, like me looking for some great reference to javascript. I found these 4 classes for javascript. which is a great “Course on introduction to Javascript, including DOM, events, animations, and objects.”

according to the read me: “Curriculum originally developed by Pamela Fox”  i think the classes where free. but i dont know where i get it from.

link to the rar:

https://drive.google.com/file/d/0B2Gltk_LlAG4MllzY2d0ejBVaGc/view?usp=sharing

link to the folder where i will be putting more javascript learning stuff:

https://drive.google.com/folderview?id=0B2Gltk_LlAG4fmhpMzN0V0toQmNLdl93aU9NMGhnY25CYm1IWFRrem11TGl6ekxzM3NSamM&usp=sharing

https://drive.google.com/file/d/0B2Gltk_LlAG4MllzY2d0ejBVaGc/view?usp=sharing
]]>

does any one know how i get this script to list all the installed apps to work inside LLX.

does any one know how i get this script to list all the installed apps to work inside LLX. I found it on some tutorial website. but i cant remember where i found it. it where 3 pieces of a script combined for a android app.

/*

List apps = getPackageManager().getInstalledPackages(0);

This method returns the list of PackageInfo (which contains overall information about the contents of a package). In other words, the method getInstalledPackages() will return a list containing all the information about all the installed application.

In this example, we will extract just the informations (packageName, appName, versionName, versionCode, and the icon), so we create a bean to store this informations:

*/

public class AppInfo {

    private String name;

    private String packageName;

    private String versionName;

    private int versionCode = 0;

    private Drawable icon;

    public AppInfo() {}

    public Intent getLaunchIntent(Context context) {

        Intent intentLaunch = context.getPackageManager().getLaunchIntentForPackage(this.packageName);

        return intentLaunch;

    }

    public String getName() {

        return name;

    }

    public void setName(String name) {

        this.name = name;

    }

    public String getPackageName() {

        return packageName;

    }

    public void setPackageName(String packageName) {

        this.packageName = packageName;

    }

    public String getVersionName() {

        return versionName;

    }

    public void setVersionName(String versionName) {

        this.versionName = versionName;

    }

    public int getVersionCode() {

        return versionCode;

    }

    public void setVersionCode(int versionCode) {

        this.versionCode = versionCode;

    }

    public Drawable getIcon() {

        return icon;

    }

    public void setIcon(Drawable icon) {

        this.icon = icon;

    }

}

/*

The last thing is to extract the application’s informations from the list of installed apps and store them in arraylist :

*/

/**

* get the list of all installed applications in the device

*@return ArrayList of installed applications or null

*/

private static ArrayList getListOfInstalledApp(Context context) {

    PackageManager packageManager = context.getPackageManager();

    List apps = packageManager.getInstalledPackages(PackageManager.SIGNATURE_MATCH);

    if (apps != null && !apps.isEmpty()) {

        ArrayList installedApps = new ArrayList();

        for (int i = 0; i < apps.size(); i++) {

            PackageInfo p = apps.get(i);

            ApplicationInfo appInfo = null;

            try { 

                appInfo = packageManager.getApplicationInfo(p.packageName, 0);

                AppInfo app = new AppInfo(); 

                app.setName(p.applicationInfo.loadLabel(packageManager).toString()); 

                app.setPackageName(p.packageName); 

                app.setVersionName(p.versionName); 

                app.setVersionCode(p.versionCode); 

                app.setIcon(p.applicationInfo.loadIcon(packageManager)); 

                //check if the application is not an application system 

                Intent launchIntent = app.getLaunchIntent(context); 

                if(launchIntent != null && (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) 

                    installedApps.add(app); 

                } catch (NameNotFoundException e) { 

                   e.printStackTrace(); 

                } 

            } 

            //sort the list of applications alphabetically 

            if (installedApps.size() > 0) {

                Collections.sort(installedApps, new Comparator() {

                   @Override

                    public int compare(final AppInfo app1, final AppInfo app2) {

                        return app1.getName().toLowerCase(Locale.getDefault()).compareTo(app2.getName().toLowerCase(Locale.getDefault()));

                    }

                });

            }

        return installedApps;

    }

    return null;

}

/*

After getting those informations about installed applications, we can display them using ListViewor GridView .

Finally, to launch an installed application directly from your application, all what you need is to retrieve the launch Intent from the appInfo instance and starts the app :

*/

ArrayList installedApps = getListOfInstalledApp(this);

Intent launchIntent = installedApps.get(0).getLaunchIntent(this);

if(launchIntent != null)

    startActivity(launchIntent);

]]>

I can’t seem to find an API reference for the LL current desktop wallpaper.

I can’t seem to find an API reference for the LL current desktop wallpaper.  How would I access a desktop specific wallpaper in order to change it in a script?  Thanks.

]]>

I’d like to use a script to update the box background of an item by referencing a file on my sdcard, but can’t get…

I’d like to use a script to update the box background of an item by referencing a file on my sdcard, but can’t get the setBoxBackground command to work. Could use some help from the script experts here …

]]>