Templates

You probably reached this page because you just created the best ever LL theme ever, and you would like to share it, right ?
Good news, as of version 8.3 Lightning Launcher has support for APK templates.

Prerequisites

  • You know what an APK is, and you know how to build it from sources, then distribute it

The quick and easy way (recommended)

The most convenient way is to use the packager tool. Use it if you are not experienced with Android source packages, or simply if you don’t want to loose time with that.

Using the tool, all you need to do is to set the template name, upload icons and the Template file. The tool generates a ready to build android package. What is left on your side is to build, sign and share the APK.

Overview of the advanced procedure

This is the overall procedure to get your template nicely packed in an APK. Follow this procedure if you need to pack several templates in a single package, or want to add other things in the APK (for instance Zooper Widget skins).

  • A. Download the sample template source package
  • B. Export your setup from Lightning Launcher, this will create a template archive
  • C. Put this archive in the sample package, adjust icon and name in the source package
  • D. Build it and share it !
  • E. Things to be aware of

A. Download the sample template source package

Get it here. It can be imported using Android Studio or Eclipse.
This sample is mostly ready to use. It already contains a default activity which will appear in your list of apps, so that tapping on it will directly start the template installation process.

A Lightning Launcher Template APK can contain one or more templates. If the package contains several templates, it will display a menu to select which one to apply.

Important: change the sample package name in the AndroidManifest.xml file, and change the name of the app (string «app_name» in res/values/strings.xml).

Very important: the package name needs to follow these rules:

  • Please do not use net.pierrox in your package name
  • Include lltemplate somewhere in your package name

In this tutorial we will assume the new package name is com.mygreattemplate.lltemplate

B. Export your setup

In Lightning Launcher, enter the main settings screen, and select “Export for APK”. This will create a «Template» archive in the LightningLauncher directory on your device (usually /sdcard/LightningLauncher/Template).

Don’t forget to set the home desktop before to export !

C. Move the template archive in the source package

Note: The sample package contains a sample template. You may either remove it and add your own template, or directly replace it by modifying files and names.

  • First select a code name for your template. This must be a valid Java class name (0-9, A-Z, a-z, _). Let’s call this template &laquoMyGreatTemplate» for instance
  • Rename the template archive from «Template» to «mygreattemplate» and move this file inside the res/raw/ directory
  • . The name of the file in res/raw need to be the name of the activity, but in lower case.

  • Save this activity in this java file: src/com/mygreattemplate/lltemplate/MyGreatTemplate.java:

    package com.mygreattemplate.lltemplate; import android.app.Activity; public class MyGreatTemplate extends Activity { // nothing more to do here }

  • Edit the AndroidManifest.xml file and add a section like this:

    <activity android:name=".MyGreatTemplate" android:label="@string/my_great_template_name" android:icon="@drawable/my_great_template_icon" android:exported="true"> <intent-filter> <action android:name="net.pierrox.lightning_launcher.TEMPLATE"/> </intent-filter> </activity>

  • Finally, edit res/values/strings.xml and add an entry for my_great_template_name, and add an icon in res/drawable/my_great_template_icon.png

D. Build it and share it !

This is up to you to build and distribute your template in any way you want, either freely or commercially.

Have fun sharing your templates !

E. Things to be aware of

App drawer items are excluded from the template: first for privacy reasons but also because it is unlikely that users of your template have the same list of apps. The style is kept however, but items position, folders and visibility are not kept.

Grid layouts are those that adapt the best to a large variety of screen, because items are usually sized according to a fraction of the screen size. In contrast the free mode uses absolute positions that dot not scale as well as the default grid mode. Lightning Launcher attempts to convert free layouts based on screen characteristics but it may result in unwanted deformations.

Lightning Launcher tries to help in the widget restoration process, but keep in mind this feature does not take into account widgets data and only Android 4.1+ support this feature.