/Android-LightningUi

Primary LanguageJavaApache License 2.0Apache-2.0

#Storm Library - Module UI

Storm is a collection of libraries that helps make mobile and desktop applications easy to create using a high quality WYSIACATWYG editor.

This module's purpose is to take a structured collection of JSON files, parse them into POJO objects and render them to the UI using their respective corresponding views.

#Usage

##Gradle

Simply include the following for your gradle dependencies com.3sidedcube.storm:ui:0.2.

Note The versioning of the library will always be as follows:

Major version.Minor version.Bug fix

It is safe to use + in part of of the Bug fix version, but do not trust it 100%. Always use a specific version to prevent regression errors.

##Code

In your application singleton, add the following code

UiSettings uiSettings = new UiSettings.Builder(this).build();

// Loading app json
String appUri = "assets://app.json";
App app = UiSettings.getInstance().getViewBuilder().buildApp(Uri.parse(appUri));

if (app != null)
{
    UiSettings.getInstance().setApp(app);
}

Then in your entry activity add the following code

Intent start = UiSettings.getInstance().getIntentFactory().getIntentForPageUri(this, Uri.parse(UiSettings.getInstance().getApp().getVector()));

if (start != null)
{
	startActivity(start);
}

This will use the vector string in your App.json to determine what page to load initially.

There are many options in the UiSettings object that allows you to override specific parts of the module.

##Language

In order to support the use of the Language module, you must include the following code for your UiSettings Builder

.textProcessor(new TextProcessor()
{
    @Nullable @Override public String process(@Nullable TextProperty textProperty)
    {
        return new LanguageTextProcessor().process(super.process(textProperty));
    }
})

#Documentation

See the Javadoc for full in-depth code-level documentation

#Contributors

Callum Taylor (9A8BAD), Tim Mathews (5C4869), Matt Allen (DB74F5), Alan Le Fournis (067EA0)

#License

See LICENSE.md