now browsing by category
If anyone else wants a script to automatically import modified .js files elsewhere on your device into the script…
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) } } }
Hi, does somebody know a good code editor that works wel with the “edit” button in the script editor menu?
Anyone can explain why ItemClick event does not work with GridView in AlertDialog?
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.
What is the best way to change the properties of multiple items via script at once?
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.
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:
does any one know how i get this script to list all the installed apps to work inside LLX.
/*
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);
]]>
D5 Creation