This repository was archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Wallpaper Json Structure
Dani Mahardhika edited this page Jun 26, 2017
·
2 revisions
This is a sample for default json structure. With dashboard configuration which available in release 3.2.0 and above, you can define your own json structure.
{
"Wallpapers":
[
{
"author": "Taken from gadgetraid",
"url": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-1.png",
"thumbUrl": "https://drive.google.com/uc?id=0B0f4ypHfNKm5TkZ0amk4TGZWYkU",
"name": "Nougat Wallpaper 1"
},
{
"author": "Taken from gadgetraid",
"url": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-2.jpg",
"thumbUrl": "https://drive.google.com/uc?id=0B0f4ypHfNKm5WTh5X054ZHJocmM",
"name": "Nougat Wallpaper 2"
}
]
}
- Open
CandyBar.java
insideapps\java\com.yourpackagename\applications\
. - Use
setWallpaperJsonStructure()
fromConfiguration
to define your own json structure. Be careful, array name, name, author, url, and thumbUrl are case sensitive.
Here an example
import com.dm.material.dashboard.candybar.utils.JsonStructure;
public class CandyBar extends CandyBarApplication {
@Override
public void onCreate() {
Configuration configuration = new Configuration();
/* This is default json structure */
configuration.setWallpaperJsonStructure(
new JsonStructure.Builder("Wallpapers")
.name("name")
.author("author")
.url("url")
.thumbUrl("thumbUrl")
.build());
initApplication(configuration);
}
}
NOTE: If you are following default json structure, you don't need to add this.
Here more example
{
"wallpapers": --> different array name
[
{
"author": "Taken from gadgetraid",
"url": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-1.png",
"name": "Nougat Wallpaper 1"
--> no thumbUrl
},
{
"author": "Taken from gadgetraid",
"url": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-2.jpg",
"name": "Nougat Wallpaper 2"
--> no thumbUrl
}
]
}
The configuration
configuration.setWallpaperJsonStructure(
new JsonStructure.Builder("wallpapers")
.name("name")
.author("author")
.url("url")
/* If thumbUrl set to null, url will be used as thumbUrl */
.thumbUrl(null)
.build());
{
"wallpapers": --> different array name
[
{
"creator": "Taken from gadgetraid", --> different author name
"imageUrl": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-1.png", --> different url name
"name": "Nougat Wallpaper 1"
--> no thumbUrl
},
{
"creator": "Taken from gadgetraid", --> different author name
"imageUrl": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-2.jpg", --> different url name
"name": "Nougat Wallpaper 2"
--> no thumbUrl
}
]
}
The configuration
configuration.setWallpaperJsonStructure(
new JsonStructure.Builder("wallpapers")
.name("name")
.author("creator")
.url("imageUrl")
.thumbUrl(null)
.build());
[ --> no array name
{
"creator": "Taken from gadgetraid", --> different author name
"imageUrl": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-1.png", --> different url name
"name": "Nougat Wallpaper 1"
--> no thumbUrl
},
{
"creator": "Taken from gadgetraid", --> different author name
"imageUrl": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-2.jpg", --> different url name
"name": "Nougat Wallpaper 2"
--> no thumbUrl
}
]
The configuration
configuration.setWallpaperJsonStructure(
new JsonStructure.Builder(null)
.name("name")
.author("creator")
.url("imageUrl")
.thumbUrl(null)
.build());
[ --> no array name
{
"creator": "Taken from gadgetraid", --> different author name
"imageUrl": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-1.png", --> different url name
--> no name
--> no thumbUrl
},
{
"creator": "Taken from gadgetraid", --> different author name
"imageUrl": "http://www.gadgetraid.com/wp-content/uploads/2016/07/android-n-nougat-wallpaper-2.jpg", --> different url name
--> no name
--> no thumbUrl
}
]
The configuration
configuration.setWallpaperJsonStructure(
new JsonStructure.Builder(null)
/* If name set to null, wallpaper name will be generated automatically
* Like: Wallpaper 1, Wallpaper 2, Wallpaper 3, ...
*/
.name(null)
.author("creator")
.url("imageUrl")
.thumbUrl(null)
.build());
- Setup
- Customization: Basic → Necessary
- Customization: Advanced → Optional
- Dashboard Configuration → Optional