Implement a Kode Editor

Implement a Kode Editor#

Starting from 3.08 Kustom allows external apps to edit Kode from the formula editor fragment. A specific button will appear on top of the editor as soon as an app providing the right Action in the Manifest will be detected, this app just needs to return the new value of the formula that will then appear in the editor. Extras will be provided in the future to get current formula being edited and globals available to the user (in Json format). Right now only basic implementation is available.

Launchers touch features support (aka remove '5' secs delay)

Launchers touch features support (aka remove ‘5’ secs delay)#

When you press “home” Android will introduce a 5 secs delay to any app and service trying to execute an intent unless the app sending that intent is the current launcher. This prevents Kustom Wallpaper to launch apps without delay since it is running as a service.

This can be easily removed by adding support within the launcher for trusted wallpapers in order to let them remove this delay via a content provider. In order to support this what you should do is the following:

Listen for preset loaded events

Listen for preset loaded events#

Starting from v3.82 Kustom sends a broadcast when a preset finishes loading. This allows external apps like Tasker to react to preset changes.

Broadcast Action#

org.kustom.action.PRESET_LOADED

Extras#

ExtraTypeDescription
org.kustom.extra.SPACE_IDStringSpace URI (e.g. kspace://klwp/0, kspace://kwgt/123)
org.kustom.extra.PRESET_TITLEStringPreset title
org.kustom.extra.EXTERNALBooleanTrue if loaded via external request (Tasker, shortcut)

Tasker Example#

  1. Create a new Profile with Event > Intent Received
  2. Set Action to org.kustom.action.PRESET_LOADED
  3. In your Task, use %space_id, %preset_title, and %external variables

Android Code Example#

BroadcastReceiver receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String spaceId = intent.getStringExtra("org.kustom.extra.SPACE_ID");
        String title = intent.getStringExtra("org.kustom.extra.PRESET_TITLE");
        boolean external = intent.getBooleanExtra("org.kustom.extra.EXTERNAL", false);
    }
};

IntentFilter filter = new IntentFilter("org.kustom.action.PRESET_LOADED");
context.registerReceiver(receiver, filter);

Load a preset in the editor from external app

Load a preset in the editor from external app#

Starting from 3.16 Kustom allows external apps to directly open a preset into the editor, this is very useful for Dashboards or preset packs in generals. So, how to do that?

Build a Kustom Uri#

You will need to pass to Kustom a specific Uri via intent, in order to build the Uri you will have to follow this format:

kfile://pkgname/folder/filename

Query widget and wallpaper info via ContentProvider

Query widget and wallpaper info via ContentProvider#

Starting from v3.82 Kustom exposes a ContentProvider to query information about configured widgets and wallpapers.

Content URI Format#

content://org.kustom.{app}.content/{variant}/{id}/info

AppAuthorityExample
KLWPorg.kustom.klwp.contentcontent://org.kustom.klwp.content/klwp/0/info
KWGTorg.kustom.kwgt.contentcontent://org.kustom.kwgt.content/kwgt/123/info
KLCKorg.kustom.klck.contentcontent://org.kustom.klck.content/klck/0/info

Returned Columns#

ColumnTypeDescription
configuredInteger1 if preset is configured, 0 otherwise
titleStringPreset title
screen_count_xIntegerHorizontal screen count (KLWP only)
screen_count_yIntegerVertical screen count (KLWP only)

Preview Image#

To get a preview thumbnail, use the png endpoint:

Send variables to Kustom via Broadcast

Send variables to Kustom via Broadcast#

Kustom from version 2.09 allows third party apps to send variables via broadcasts. In order to send a broadcast to Kustom you will need this static entries defined in your code:

public static final String KUSTOM_ACTION = "org.kustom.action.SEND_VAR";  
public static final String KUSTOM_ACTION_EXT_NAME = "org.kustom.action.EXT_NAME";  
public static final String KUSTOM_ACTION_VAR_NAME = "org.kustom.action.VAR_NAME";  
public static final String KUSTOM_ACTION_VAR_VALUE = "org.kustom.action.VAR_VALUE";  
public static final String KUSTOM_ACTION_VAR_NAME_ARRAY = "org.kustom.action.VAR_NAME_ARRAY";  
public static final String KUSTOM_ACTION_VAR_VALUE_ARRAY = "org.kustom.action.VAR_VALUE_ARRAY";

Then you will need to send a broadcast always providing an “EXT_NAME” and then providing either a single name/value pair or an array of them. So, for example, if we have an application called “foo” that wants to send “myvar” with value “myvalue” you will do something like this:




Privacy Policy