Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
JavaSE Guides
Customizing the Template

Customizing the Template

You have the ability to customize the look and feel of the template. How much customization is available depends on the RPC version of the head unit you are connected with as well as the design of the HMI.

Customizing Template Colors (RPC v5.0+)

You can customize the color scheme of your app using template coloring APIs.

Customizing the Default Layout

You can change the template colors of the initial template layout in the lifecycleConfiguration.

Template Coloring from Above

// Set color schemes
RGBColor green = new RGBColor(126, 188, 121);
RGBColor white = new RGBColor(249, 251, 254);
RGBColor grey = new RGBColor(186, 198, 210);
RGBColor darkGrey = new RGBColor(57, 78, 96);

TemplateColorScheme dayColorScheme = new TemplateColorScheme()
    .setBackgroundColor(white)
    .setPrimaryColor(green)
    .setSecondaryColor(grey);
builder.setDayColorScheme(dayColorScheme);

TemplateColorScheme nightColorScheme = new TemplateColorScheme()
    .setBackgroundColor(white)
    .setPrimaryColor(green)
    .setSecondaryColor(darkGrey);
builder.setNightColorScheme(nightColorScheme);
Note

You may only change the template coloring once per template; that is, you cannot call changeLayout, SetDisplayLayout or Show for the template you are already on and expect the color scheme to update.

Customizing Future Layouts

You can change the template color scheme when you change layouts. This guide requires SDL Java Suite version 5.0. If using an older version, use SetDisplayLayout (any RPC version) or Show (RPC v6.0+) request.

// Set color schemes
RGBColor green = new RGBColor(126, 188, 121);
RGBColor white = new RGBColor(249, 251, 254);
RGBColor grey = new RGBColor(186, 198, 210);
RGBColor darkGrey = new RGBColor(57, 78, 96);

TemplateColorScheme dayColorScheme = new TemplateColorScheme()
    .setBackgroundColor(white)
    .setPrimaryColor(green)
    .setSecondaryColor(grey);

TemplateColorScheme nightColorScheme = new TemplateColorScheme()
    .setBackgroundColor(white)
    .setPrimaryColor(green)
    .setSecondaryColor(darkGrey);

TemplateConfiguration templateConfiguration = new TemplateConfiguration()
    .setTemplate(PredefinedLayout.GRAPHIC_WITH_TEXT.toString())
    .setDayColorScheme(dayColorScheme)
    .setNightColorScheme(nightColorScheme);

sdlManager.getScreenManager().changeLayout(templateConfiguration, new CompletionListener() {
    @Override
    public void onComplete(boolean success) {
        if (success) {
            // Color set with template change
        } else {
            // Color and template not changed 
        }
    }
});

Customizing the Menu Title and Icon

You can also customize the title and icon of the main menu button that appears on your template layouts. The menu icon must first be uploaded with a specific name through the file manager; see the Uploading Images section for more information on how to upload your image.

// The image must be uploaded before referencing the image name here
SetGlobalProperties setGlobalProperties = new SetGlobalProperties()
    .setMenuTitle("customTitle")
    .setMenuIcon(image);

setGlobalProperties.setOnRPCResponseListener(new OnRPCResponseListener() {
    @Override
    public void onResponse(int correlationId, RPCResponse response) {
        if (response.getSuccess()){
            // Success
        }
    }
});
sdlManager.sendRPC(setGlobalProperties);
View on GitHub.com
Previous Section Next Section