Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Wallpaper Json Structure

Dani Mahardhika edited this page Oct 30, 2017 · 7 revisions

This is a sample for default json structure. With dashboard configuration which available in release 1.7.0-b1 and above, you can define your own json structure.

{
    "Categories": 
        [
            {
                "name": "KitKat"
            },
            {
                "name": "Lollipop"
            }
        ],

    "Wallpapers":
        [
            {
		"author": "Taken from androidpolice",
		"url": "http://www.androidpolice.com/wp-content/uploads/2014/10/nexus2cee_lollipop-wallpaper-01.jpg",
		"thumbUrl": "https://drive.google.com/uc?id=0B0f4ypHfNKm5M0NoYUlTU3lFY1U",
		"name": "L Wallpaper 1",
                "category": "lollipop"
	     },
             {
		"author": "Taken from androidpolice",
		"url": "http://www.androidpolice.com/wp-content/uploads/2013/11/nexusae0_wallpaper_50.jpg",
		"thumbUrl": "https://drive.google.com/uc?id=0B0f4ypHfNKm5Wk16eXdqQlR5eE0",
		"name": "Kitkat Wallpaper 1",
                "category": "kitkat"
	    }
        ]
}

How to change wallpaper json structure?

  1. Open WallpaperBoard.java inside apps\java\com.yourpackagename\applications\.
  2. Use setJsonStructure() from WallpaperBoardConfiguration to define your own json structure. Be careful, array name, name, author, url, thumbUrl, and category are case sensitive.

Here an example

import android.support.annotation.NonNull;

import com.dm.wallpaper.board.applications.WallpaperBoardApplication;
import com.dm.wallpaper.board.applications.WallpaperBoardConfiguration;
import com.dm.wallpaper.board.utils.JsonStructure;

public class WallpaperBoard extends WallpaperBoardApplication {

    @NonNull
    @Override
    public WallpaperBoardConfiguration onInit() {
        WallpaperBoardConfiguration configuration = new WallpaperBoardConfiguration();

        /* This is default json structure */
        configuration.setJsonStructure(
                new JsonStructure.Builder()
                        .jsonOutputUrl(null)
                        .categoryStructure(
                                new JsonStructure.CategoryStructure("Categories")
                                        .name("name"))
                        .wallpaperStructure(
                                new JsonStructure.WallpaperStructure("Wallpapers")
                                        .name("name")
                                        .author("author")
                                        .url("url")
                                        .thumbUrl("thumbUrl")
                                        .category("category"))
                        .build());
        return configuration;
    }
}