Skip to content

Dashboard Configuration

Dani Mahardhika edited this page Aug 12, 2017 · 13 revisions

This configuration is optional, but for future updates I think I'm going to add new configurations here.

What is dashboard configuration?

Basically it provides some options, but it must be configured programmatically. Dashboard configuration only available in release 3.2.0 and above.

How to configure it?

  1. Open CandyBar.java inside apps\java\com.yourpackagename\applications\ then you will see something like this,
public class CandyBar extends CandyBarApplication {

    @Override
    public void onCreate() {
        initApplication();
    }
}
  1. Declare the configuration class and pass it to initApplication()
public class CandyBar extends CandyBarApplication {

    @Override
    public void onCreate() {
        Configuration configuration = new Configuration();
        initApplication(configuration);
    }
}
  1. At the moment you are using default generated configuration, you can customize it based on your needs. These are available customization,
  • setGenerateAppFilter(boolean) → Generate appfilter.xml when building icon request
  • setGenerateAppMap(boolean) → Generate appmap.xml when building icon request
  • setGenerateThemeResources(boolean) → Generate theme_resources.xml when building icon request
  • setIncludeIconRequestToEmailBody(boolean) → Include icon request text to email body
  • setNavigationIcon(NavigationIcon) → Change navigation icon (top left)
  • setNavigationViewHeaderStyle(NavigationViewHeaderStyle) → Change navigation drawer header style
  • setHomeGridStyle(GridStyle) → Change home grid style, card of flat.
  • setApplyGridStyle(GridStyle) → Change apply grid style, card of flat.
  • setWallpapersGridStyle(GridStyle) → Change wallpapers grid style, card of flat.
  • setRequestStyle(Style) → Change request style, card or flat.
  • setAboutStyle(Style) → Change about style, card or flat.
  • setSocialIconColor(IconColor) → Change icon color of iconized social buttons
  • setAutomaticIconsCountEnabled(boolean) → Enable or disable automatic icons counting
  • setCustomIconsCount(int) → Set custom number for icons count
  • setShowTabIconsCount(boolean) → Show icons count in tab inside icons section
  • setShowTabAllIcons(boolean) → Add tab showing all icons inside icons section
  • setTabAllIconsTitle(String) → Set all icons tab title, default it "All Icons".
  • setCategoryForTabAllIcons(String[]) → Set which category will be included inside all icons tab, default all categories will be included.
  • setShadowEnabled(boolean) → Enable or disable shadow
  • setShadowEnabled(ShadowOptions) → Use options for shadow, see here for more info.
  • setDashboardThemingEnabled(boolean) → Enable or disable dashboard theme, if disabled user not be able to change dashboard theme from settings.
  • setWallpaperGridPreviewQuality(int) → Set wallpaper grid thumbnail preview quality
  • setCrashReportEnabled(boolean) → Enable or disable crash report
  • setWallpaperJsonStructure(JsonStructure) → Use different json structure for cloud wallpapers, read here for more info.
  • setColoredApplyCard(boolean) → Enable or disable auto generated color for launchers card.
  • setOtherApps(OtherApp[]) → Show more apps inside a dialog, see here for more info.

What is default configuration?

By calling

Configuration configuration = new Configuration();

It's the same as

Configuration configuration = new Configuration();

configuration.setGenerateAppFilter(true);
configuration.setGenerateAppMap(false);
configuration.setGenerateThemeResources(false);
configuration.setIncludeIconRequestToEmailBody(true);
configuration.setNavigationIcon(NavigationIcon.STYLE_1);
configuration.setNavigationViewHeaderStyle(NavigationViewHeader.NORMAL);
configuration.setHomeGridStyle(GridStyle.CARD);
configuration.setApplyGridStyle(GridStyle.CARD);
configuration.setRequestStyle(Style.PORTRAIT_FLAT_LANDSCAPE_CARD);
configuration.setWallpapersGridStyle(GridStyle.CARD);
configuration.setAboutStyle(Style.PORTRAIT_FLAT_LANDSCAPE_CARD);
configuration.setSocialIconColor(IconColor.PRIMARY_TEXT);
configuration.setAutomaticIconsCountEnabled(true);
configuration.setShowTabIconsCount(false);
configuration.setShowTabAllIcons(false);
configuration.setTabAllIconsTitle("All Icons");
configuration.setShadowEnabled(true);
configuration.setDashboardThemingEnabled(true);
configuration.setWallpaperGridPreviewQuality(4);
configuration.setCrashReportEnabled(true);
configuration.setColoredApplyCard(true);

So if you are not going to change the default configuration, you don't need to add it.

Still confused?

Here a sample configuration

public class CandyBar extends CandyBarApplication {

    @Override
    public void onCreate() {
        Configuration configuration = new Configuration();
        
        configuration.setGenerateAppFilter(true);
        configuration.setGenerateAppMap(true);
        configuration.setGenerateThemeResources(true);
        
        configuration.setNavigationIcon(NavigationIcon.STYLE_4);
        configuration.setNavigationViewHeaderStyle(NavigationViewHeader.NONE);
        
        configuration.setHomeGridStyle(GridStyle.FLAT);
        configuration.setApplyGridStyle(GridStyle.FLAT);
        configuration.setWallpapersGridStyle(GridStyle.FLAT);
        configuration.setRequestStyle(Style.PORTRAIT_FLAT_LANDSCAPE_FLAT);
        configuration.setAboutStyle(Style.PORTRAIT_FLAT_LANDSCAPE_FLAT);

        configuration.setShowTabAllIcons(true);
        configuration.setCategoryForTabAllIcons(new String[] {
                "Games", "Apps"
        });

        initApplication(configuration);
    }
}

Show More Apps

With release 3.3.0 you can show more apps inside a dialog that will shown when user press more apps card in home section.

Configuration configuration = new Configuration();
...
 OtherApp[] otherApps = new OtherApp[] {
        new OtherApp(
                //You can use png file (without extension) inside drawable-nodpi folder or url
                "icon",
                "Title",
                "Description",
                "http://www.url.com"),
        new OtherApp(
                //You can use png file (without extension) inside drawable-nodpi folder or url
                "https://avatars1.githubusercontent.com/u/23138905?v=3&s=300",
                "Title",
                "Description, long description. This is an example of long description.",
                "https://play.google.com/store/apps/details?id=com.material.dashboard.candybar.demo")
};
configuration.setOtherApps(otherApps);

Shadow Options

With release 3.3.2 you can use options to disable or enable shadow.

Configuration configuration = new Configuration();
...
ShadowOptions options = new ShadowOptions();
//Enable or disable toolbar shadow
options.setToolbarEnabled(true);
//Enable or disable card shadow
options.setCardEnabled(false);
//Enable or disable floating action button shadow
options.setFabEnabled(true);
//Enable or disable tap intro shadow
options.setTapIntroEnabled(true);

//Don't forget to pass it to configuration
configuration.setShadowEnabled(options);